From 68aa3fa29e4e95a3678e80c1dbeed623dfe89057 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 7 Aug 2015 18:03:45 -0700 Subject: giver provider objects an env variable. --- lib/leap_cli/config/manager.rb | 3 +++ lib/leap_cli/config/provider.rb | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'lib/leap_cli') 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 -- cgit v1.2.3