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

Commit

Permalink
Merge pull request #8 from trstickland/env_var_for_config
Browse files Browse the repository at this point in the history
hotfix for config file environment variable
  • Loading branch information
trstickland authored Jul 9, 2019
2 parents 77bc338 + d76cea2 commit 33a735e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/gffmunger
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ config_env_var = 'GFFMUNGER_CONFIG'
config_default_path = '/etc/gffmunger'
config_filename = 'gffmunger-config.yml'
config_file_path = None
# first, check environment variable has been set
# first, check if config file path is defined in environment
if config_env_var is not None and config_env_var in os.environ and os.environ[config_env_var] is not None:
config_file_path = os.environ[config_env_var]
# second, check /etc/gffmunger
if os.path.exists(config_default_path):
config_file_path = os.path.join(config_default_path,config_filename)
if config_file_path is None or not os.path.exists(config_file_path):
if os.path.exists(config_default_path):
config_file_path = os.path.join(config_default_path,config_filename)
# second check under sys.prefix (will be here if installed with pip)
if config_file_path is None or not os.path.exists(config_file_path):
config_sys_path = os.path.join(sys.prefix,'config')
Expand Down

0 comments on commit 33a735e

Please sign in to comment.