Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 33a735e

Browse files
authored
Merge pull request #8 from trstickland/env_var_for_config
hotfix for config file environment variable
2 parents 77bc338 + d76cea2 commit 33a735e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/gffmunger

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ config_env_var = 'GFFMUNGER_CONFIG'
2222
config_default_path = '/etc/gffmunger'
2323
config_filename = 'gffmunger-config.yml'
2424
config_file_path = None
25-
# first, check environment variable has been set
25+
# first, check if config file path is defined in environment
2626
if config_env_var is not None and config_env_var in os.environ and os.environ[config_env_var] is not None:
2727
config_file_path = os.environ[config_env_var]
2828
# second, check /etc/gffmunger
29-
if os.path.exists(config_default_path):
30-
config_file_path = os.path.join(config_default_path,config_filename)
29+
if config_file_path is None or not os.path.exists(config_file_path):
30+
if os.path.exists(config_default_path):
31+
config_file_path = os.path.join(config_default_path,config_filename)
3132
# second check under sys.prefix (will be here if installed with pip)
3233
if config_file_path is None or not os.path.exists(config_file_path):
3334
config_sys_path = os.path.join(sys.prefix,'config')

0 commit comments

Comments
 (0)