diff --git a/bin/trytond b/bin/trytond index ea20af1ab9..a55d02c253 100755 --- a/bin/trytond +++ b/bin/trytond @@ -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() diff --git a/trytond/config.py b/trytond/config.py index 58c27ee484..417ea584f2 100644 --- a/trytond/config.py +++ b/trytond/config.py @@ -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: