summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/changes/create_db_cmd1
-rwxr-xr-xserver/pkg/create-user-db3
-rw-r--r--server/src/leap/soledad/server/__init__.py11
3 files changed, 9 insertions, 6 deletions
diff --git a/server/changes/create_db_cmd b/server/changes/create_db_cmd
index cee0a935..964a7906 100644
--- a/server/changes/create_db_cmd
+++ b/server/changes/create_db_cmd
@@ -1,3 +1,4 @@
o Adds a new config parameter 'create_cmd', which allows sysadmin to specify
which command will create a database. That command was added in
pkg/create-user-db and debian package automates steps needed for sudo access.
+ o Read netrc path from configuration file for create-user-db command.
diff --git a/server/pkg/create-user-db b/server/pkg/create-user-db
index 1a7e77a7..ae2f0f57 100755
--- a/server/pkg/create-user-db
+++ b/server/pkg/create-user-db
@@ -21,6 +21,7 @@ import netrc
import argparse
from leap.soledad.common.couch import CouchDatabase
from leap.soledad.common.couch import is_db_name_valid
+from leap.soledad.server import load_configuration
description = """
@@ -30,7 +31,7 @@ This is meant to be used by Soledad Server.
parser = argparse.ArgumentParser(description=description)
parser.add_argument('dbname', metavar='user-d34db33f', type=str,
help='database name on the format user-{uuid4}')
-NETRC_PATH = '/etc/couchdb/couchdb-admin.netrc'
+NETRC_PATH = load_configuration('/etc/leap/soledad-server.conf')['admin_netrc']
def url_for_db(dbname):
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index bb1c6db0..1273d15c 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -283,19 +283,20 @@ def load_configuration(file_path):
@return: A dictionary with the configuration.
@rtype: dict
"""
- conf = {
+ defaults = {
'couch_url': 'http://localhost:5984',
- 'create_cmd': None
+ 'create_cmd': None,
+ 'admin_netrc': '/etc/couchdb/couchdb-admin.netrc',
}
config = configparser.ConfigParser()
config.read(file_path)
if 'soledad-server' in config:
- for key in conf:
+ for key in defaults:
if key in config['soledad-server']:
- conf[key] = config['soledad-server'][key]
+ defaults[key] = config['soledad-server'][key]
# TODO: implement basic parsing/sanitization of options comming from
# config file.
- return conf
+ return defaults
# ----------------------------------------------------------------------------