env-checker 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/env_checker.rb +1 -0
- data/lib/env_checker/cli.rb +3 -2
- data/lib/env_checker/configuration.rb +8 -1
- data/lib/env_checker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d606bb4975be0f760db096c69b4a23c746c6ec2f
|
4
|
+
data.tar.gz: 4d302b7b62a1dd1af3fbc4429128ed1060702a7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28805353881884386a46352ce6d3d6a435bcddc1394834a4d973816aabf3f46e9d428c52ae19f7e6596f10d0a7dca921160bf335d607d03b24e41d2179e0da8a
|
7
|
+
data.tar.gz: 01edfd571a14417c19f1d8df31b46bebe5fd1d18a73ada466cc02b8104ac8a88d25d6bae48c95e535ed0ffa6a0cfa69c1eba942c8a38603ddd288d68d41c49d9
|
data/Gemfile.lock
CHANGED
data/lib/env_checker.rb
CHANGED
@@ -57,6 +57,7 @@ module EnvChecker
|
|
57
57
|
return { 'global' => config }
|
58
58
|
end
|
59
59
|
|
60
|
+
config.environment = options[:environment] if options[:environment]
|
60
61
|
config.optional_variables = options[:optional] if options[:optional]
|
61
62
|
config.required_variables = options[:required] if options[:required]
|
62
63
|
config.slack_webhook_url = options[:slack] if options[:slack]
|
data/lib/env_checker/cli.rb
CHANGED
@@ -7,9 +7,10 @@ module EnvChecker
|
|
7
7
|
puts "EnvChecker #{EnvChecker::VERSION}"
|
8
8
|
end
|
9
9
|
|
10
|
+
option :environment, :aliases => :e, :type => :string
|
10
11
|
option :config_file, :aliases => :cf, :type => :string
|
11
|
-
option :
|
12
|
-
option :
|
12
|
+
option :required_variables, :aliases => [:r, :required], :type => :array
|
13
|
+
option :optional_variables, :aliases => [:o, :optional], :type => :array
|
13
14
|
option :slack_webhook_url, :aliases => :slack, :type => :string
|
14
15
|
desc 'check', 'Check optional and required environment variables.'
|
15
16
|
def check
|
@@ -40,11 +40,18 @@ module EnvChecker
|
|
40
40
|
raise ConfigurationError.new("Invalid value optional_variables: #{optional_variables}")
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
unless valid_url?(slack_webhook_url)
|
44
44
|
raise ConfigurationError.new("Invalid value slack_webhook_url: #{slack_webhook_url}")
|
45
45
|
end
|
46
46
|
|
47
47
|
true
|
48
48
|
end
|
49
|
+
|
50
|
+
def valid_url?(uri)
|
51
|
+
return true unless uri
|
52
|
+
|
53
|
+
valid = (uri =~ URI.regexp(%w(http https)))
|
54
|
+
valid && valid.zero?
|
55
|
+
end
|
49
56
|
end
|
50
57
|
end
|
data/lib/env_checker/version.rb
CHANGED