- commit
- fa14732848d2b643d1988e583602b470c591fb27
- parent
- 82330c8159157548c1d97cc8dbe4c7e1a8ea9aea
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2015-02-07 20:10
use local or home config by default
Diffstat
| M | README.rst | 4 | +++- |
| M | plutopluto/__init__.py | 8 | ++++++++ |
2 files changed, 11 insertions, 1 deletions
diff --git a/README.rst b/README.rst
@@ -66,7 +66,9 @@ Configuration 66 66 67 67 You can configure all `flask related options`_ as well as ``HOST``, ``PORT`` 68 68 and ``URLS`` in a separate configuration file using ``plutopluto --config69 -1 FILE``. See ``example.cfg`` for an example.-1 69 FILE``. See ``example.cfg`` for an example. If no configurations is provided, -1 70 the file ``.plutopluto.cfg`` is tried, first in the current folder, then in -1 71 home. 70 72 71 73 Some options can be passed to plutopluto directly. See ``plutopluto --help``. 72 74 If defined, they take precedence over those from the config file.
diff --git a/plutopluto/__init__.py b/plutopluto/__init__.py
@@ -108,8 +108,16 @@ def main(): 108 108 help='full feed url, optionally with a {page} placeholder') 109 109 args = parser.parse_args() 110 110 -1 111 config_name = '.plutopluto.cfg' -1 112 local_config = os.path.abspath(config_name) -1 113 home_config = os.path.expanduser('~/' + config_name) -1 114 111 115 if args.config: 112 116 app.config.from_pyfile(os.path.abspath(args.config)) -1 117 elif os.path.exists(local_config): -1 118 app.config.from_pyfile(local_config) -1 119 elif os.path.exists(home_config): -1 120 app.config.from_pyfile(home_config) 113 121 app.debug = args.debug 114 122 app.config['URLS'] = args.urls + app.config.get('URLS', []) 115 123