diff options
author | elijah <elijah@riseup.net> | 2015-08-07 18:03:45 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-08-07 18:03:45 -0700 |
commit | 68aa3fa29e4e95a3678e80c1dbeed623dfe89057 (patch) | |
tree | 8598c6201f2c6bb30f181a547866a4b8a6d71af4 | |
parent | e2b76364383d7c7de0ecfa56c17f62cd1b1a6bd1 (diff) |
giver provider objects an env variable.
-rw-r--r-- | lib/leap_cli/config/manager.rb | 3 | ||||
-rw-r--r-- | lib/leap_cli/config/provider.rb | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb index cd4a3d6..aee2ed2 100644 --- a/lib/leap_cli/config/manager.rb +++ b/lib/leap_cli/config/manager.rb @@ -119,6 +119,7 @@ module LeapCli e.services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir), Config::Tag, :no_dots => true) e.tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir), Config::Tag, :no_dots => true) e.provider = load_json( Path.named_path(:provider_config, @provider_dir), Config::Provider, :assert => true) + e.provider.set_env('default') e.services.inherit_from! @base_services e.tags.inherit_from! @base_tags e.provider.inherit_from! @base_provider @@ -134,6 +135,7 @@ module LeapCli e.services.inherit_from! env('default').services e.tags.inherit_from! env('default').tags e.provider.inherit_from! env('default').provider + e.provider.set_env('_all_') end # For each defined environment, load provider services, tags, and provider.json. @@ -147,6 +149,7 @@ module LeapCli e.services.inherit_from! env('default').services e.tags.inherit_from! env('default').tags e.provider.inherit_from! env('default').provider + e.provider.set_env(ename) validate_provider(e.provider) end end diff --git a/lib/leap_cli/config/provider.rb b/lib/leap_cli/config/provider.rb index 224e57b..06c49aa 100644 --- a/lib/leap_cli/config/provider.rb +++ b/lib/leap_cli/config/provider.rb @@ -4,6 +4,10 @@ module LeapCli; module Config class Provider < Object + attr_reader :environment + def set_env(e) + @environment = e + end def provider self end |