commit/galaxy-central: jmchilton: Allow configuration of Galaxy via environment variables.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/42f677bab2e4/ Changeset: 42f677bab2e4 User: jmchilton Date: 2014-09-22 02:02:09+00:00 Summary: Allow configuration of Galaxy via environment variables. Allow overriding config defaults (those not specified in the configuration file) with GALAXY_CONFIG_<config-name> and allow overriding actual configured values with GALAXY_CONFIG_OVERRIDE_<config-name>. Here config-name is the actual value in galaxy.ini but in upper case. Affected #: 1 file diff -r 5fac4d4b7d7d6b056056bf2a6094c7777dc28a71 -r 42f677bab2e4880b62758614fcb2c7dc27013788 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -20,6 +20,9 @@ log = logging.getLogger( __name__ ) +CONFIG_DEFAULT_PREFIX = "GALAXY_CONFIG_" +CONFIG_OVERRIDE_PREFIX = "GALAXY_CONFIG_OVERRIDE_" + def resolve_path( path, root ): """If 'path' is relative make absolute by prepending 'root'""" @@ -36,6 +39,15 @@ deprecated_options = ( 'database_file', ) def __init__( self, **kwargs ): + for key in os.environ: + if key.startswith( CONFIG_OVERRIDE_PREFIX ): + config_key = key[ len( CONFIG_OVERRIDE_PREFIX ): ].lower() + kwargs[ config_key ] = os.environ[ key ] + elif key.startswith( CONFIG_DEFAULT_PREFIX ): + config_key = key[ len( CONFIG_DEFAULT_PREFIX ): ].lower() + if config_key not in kwargs: + kwargs[ config_key ] = os.environ[ key ] + self.config_dict = kwargs self.root = kwargs.get( 'root_dir', '.' ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org