diff options
author | Kali Kaneko <kali@leap.se> | 2017-02-12 20:33:48 +0100 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-02-12 20:33:48 +0100 |
commit | 6cabe46e4671627c22d5eed9ebb3bdc751948414 (patch) | |
tree | ebb2ffd5ba2a28d48683d909fec522a21dffd8fa | |
parent | 05b604a7134866c23aa98069cfc8542feaa08404 (diff) |
[refactor] update create-user-db script to use config refactor
-rwxr-xr-x | server/pkg/create-user-db | 7 | ||||
-rw-r--r-- | server/src/leap/soledad/server/_config.py | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/server/pkg/create-user-db b/server/pkg/create-user-db index 9e2b6b50..fe1a99a0 100755 --- a/server/pkg/create-user-db +++ b/server/pkg/create-user-db @@ -38,8 +38,9 @@ parser.add_argument('dbname', metavar='user-d34db33f', type=str, help='database name on the format user-{uuid4}') parser.add_argument('--migrate-all', action='store_true', help="recreate all design docs for all existing account") -CONF = load_configuration('/etc/soledad/soledad-server.conf') -NETRC_PATH = CONF['soledad-server']['admin_netrc'] +CONF = get_config() +DBCONF = get_config(section='database-security') +NETRC_PATH = CONF['admin_netrc'] def url_for_db(dbname): @@ -78,7 +79,7 @@ def ensure_database(dbname): print ("Invalid name! %s" % dbname) sys.exit(1) url = url_for_db(dbname) - db_security = CONF['database-security'] + db_security = DBCONF db = CouchDatabase.open_database(url=url, create=True, replica_uid=None, database_security=db_security) diff --git a/server/src/leap/soledad/server/_config.py b/server/src/leap/soledad/server/_config.py index 2c7f530d..1818c38d 100644 --- a/server/src/leap/soledad/server/_config.py +++ b/server/src/leap/soledad/server/_config.py @@ -42,11 +42,11 @@ CONFIG_DEFAULTS = { _config = None -def get_config(): +def get_config(section='soledad-server'): global _config if not _config: _config = _load_config('/etc/soledad/soledad-server.conf') - return _config['soledad-server'] + return _config[section] def _load_config(file_path): |