Read config file path from TRYTOND_CONFIG env variable if no config file is specified.
issue3323 review1004002
This commit is contained in:
+3
-1
@@ -43,7 +43,9 @@ def parse_commandline():
|
||||
|
||||
parser.epilog = 'The first time a database is initialized with "-i" admin'\
|
||||
' password is read from file defined by TRYTONPASSFILE '\
|
||||
'environment variable or interactively ask user'
|
||||
'environment variable or interactively ask user. '\
|
||||
'The config file can be specified in the TRYTOND_CONFIG '\
|
||||
'environment variable.'
|
||||
|
||||
(opt, _) = parser.parse_args()
|
||||
|
||||
|
||||
+11
-9
@@ -108,15 +108,17 @@ class ConfigManager(object):
|
||||
|
||||
def update_etc(self, configfile=None):
|
||||
if configfile is None:
|
||||
prefixdir = os.path.abspath(os.path.normpath(os.path.join(
|
||||
os.path.dirname(sys.prefix), '..')))
|
||||
configfile = os.path.join(prefixdir, 'etc', 'trytond.conf')
|
||||
if not os.path.isfile(configfile):
|
||||
configdir = os.path.abspath(os.path.normpath(os.path.join(
|
||||
os.path.dirname(__file__), '..')))
|
||||
configfile = os.path.join(configdir, 'etc', 'trytond.conf')
|
||||
if not os.path.isfile(configfile):
|
||||
configfile = None
|
||||
configfile = os.environ.get('TRYTOND_CONFIG')
|
||||
if not configfile:
|
||||
prefixdir = os.path.abspath(os.path.normpath(os.path.join(
|
||||
os.path.dirname(sys.prefix), '..')))
|
||||
configfile = os.path.join(prefixdir, 'etc', 'trytond.conf')
|
||||
if not os.path.isfile(configfile):
|
||||
configdir = os.path.abspath(os.path.normpath(os.path.join(
|
||||
os.path.dirname(__file__), '..')))
|
||||
configfile = os.path.join(configdir, 'etc', 'trytond.conf')
|
||||
if not os.path.isfile(configfile):
|
||||
configfile = None
|
||||
|
||||
self.configfile = configfile
|
||||
if not self.configfile:
|
||||
|
||||
Reference in New Issue
Block a user