[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Remove is_initted and add config paths



commit 4e73693a132a28e53f9f646c0841fd344bace785
Author: juga0 <juga@xxxxxxxxxx>
Date:   Wed Jul 18 19:56:08 2018 +0000

    Remove is_initted and add config paths
---
 sbws/globals.py | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/sbws/globals.py b/sbws/globals.py
index a00cfb1..56597b1 100644
--- a/sbws/globals.py
+++ b/sbws/globals.py
@@ -8,10 +8,6 @@ RESULT_VERSION = 4
 WIRE_VERSION = 1
 SPEC_VERSION = '1.1.0'
 
-PKG_DIR = os.path.abspath(os.path.dirname(__file__))
-
-SOCKET_TIMEOUT = 60  # seconds
-
 # This is a dictionary of torrc options we always want to set when launching
 # Tor and that do not depend on any runtime configuration
 TORRC_STARTING_POINT = {
@@ -27,23 +23,17 @@ TORRC_STARTING_POINT = {
     'UseMicrodescriptors': '0',
 }
 
+PKG_DIR = os.path.abspath(os.path.dirname(__file__))
+DEFAULT_CONFIG_PATH = os.path.join(PKG_DIR, 'config.default.ini')
+DEFAULT_LOG_CONFIG_PATH = os.path.join(PKG_DIR, 'config.log.default.ini')
+MINIMUM_USER_CONFIG_PATH = os.path.join(PKG_DIR, 'config.user.ini')
+USER_CONFIG_PATH = os.path.join(os.path.expanduser('~'), '.sbws.ini')
+
+SOCKET_TIMEOUT = 60  # seconds
 SCALE_CONSTANT = 7500
 BW_LINE_SIZE = 510
 
 
-def is_initted(d):
-    if not os.path.isdir(d):
-        log.debug('%s not initialized: %s doesn\'t exist', d, d)
-        return False
-    conf_fnames = [os.path.join(d, 'config.ini')]
-    for fname in conf_fnames:
-        if not os.path.isfile(fname):
-            log.debug('%s not initialized: missing %s', d, fname)
-            return False
-    log.debug('%s seems initialized.', d)
-    return True
-
-
 def fail_hard(*a, **kw):
     ''' Log something ... and then exit as fast as possible '''
     log.critical(*a, **kw)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits