diff options
author | drebs <drebs@leap.se> | 2013-04-30 17:07:49 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-04-30 17:07:49 -0300 |
commit | 4ca21f9307bc5c4966dffbef4dc8b7cfca05095f (patch) | |
tree | 5be1192ceff708570dafb836621b805e109c71e2 /src/leap/soledad/config.py | |
parent | 3368a73fc60e3631c1359d55fde377d02ca849a6 (diff) |
Remove dependence on BaseConfig.
Also does:
* Remove config_path so soledad does not read configuration from file.
* Change shared_db_url to server_db.
* Make sync and shared_db use server_db.
Diffstat (limited to 'src/leap/soledad/config.py')
-rw-r--r-- | src/leap/soledad/config.py | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/src/leap/soledad/config.py b/src/leap/soledad/config.py deleted file mode 100644 index 733ad9e7..00000000 --- a/src/leap/soledad/config.py +++ /dev/null @@ -1,97 +0,0 @@ -# -*- coding: utf-8 -*- -# config.py -# Copyright (C) 2013 LEAP -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - - -""" -Management of configuration sources for Soledad. -""" - -import os -import logging - - -from xdg import BaseDirectory -from leap.common.config.baseconfig import BaseConfig - - -logger = logging.getLogger(name=__name__) - - -PREFIX = os.path.join( - BaseDirectory.xdg_config_home, - 'leap', 'soledad') - - -soledad_config_spec = { - 'description': 'sample soledad config', - 'type': 'object', - 'properties': { - 'secret_path': { - 'type': unicode, - 'default': PREFIX + '/secret.gpg', - 'required': True, - }, - 'local_db_path': { - #'type': unicode, - 'default': PREFIX + '/soledad.u1db', - 'required': True, - }, - 'shared_db_url': { - 'type': unicode, - 'default': 'http://provider/soledad/shared', - 'required': True, # should this be True? - }, - } -} - - -class SoledadConfig(BaseConfig): - - def _get_spec(self): - """ - Returns the spec object for the specific configuration - """ - return soledad_config_spec - - def get_secret_path(self): - return self._safe_get_value("secret_path") - - def get_local_db_path(self): - return self._safe_get_value("local_db_path") - - def get_shared_db_url(self): - return self._safe_get_value("shared_db_url") - - -if __name__ == "__main__": - logger = logging.getLogger(name='leap') - logger.setLevel(logging.DEBUG) - console = logging.StreamHandler() - console.setLevel(logging.DEBUG) - formatter = logging.Formatter( - '%(asctime)s ' - '- %(name)s - %(levelname)s - %(message)s') - console.setFormatter(formatter) - logger.addHandler(console) - - soledadconfig = SoledadConfig() - - try: - soledadconfig.get_local_db_path() - except Exception as e: - assert isinstance(e, AssertionError), "Expected an assert" - print "Safe value getting is working" |