canzea 0.1.54 → 0.1.55
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/lib/canzea/version.rb +1 -1
- data/lib/canzea.rb +7 -0
- data/lib/commands/add-env.rb +49 -0
- data/lib/commands/apply-config.rb +2 -15
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cce9704401be639be72063717b47d776a9b1cdd1
|
4
|
+
data.tar.gz: 68a790bf026914a2d38232d4575abcf84fa870e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0de7f805d78039473cbd95a173f16d47480115c90f89c4d3810697d11a86e192ee628d3be6057997891b185ff3e74b772628259cec3c67084563623ca3a35b6
|
7
|
+
data.tar.gz: 4d5e45b66fbddb5dea10aea277e3716669e7a4869206ccde37956f72b95e236fe918c8b57e9cbff6e1e0385cea5df7d204fcaae8b879ba271b9d5f59de54b62a
|
data/lib/canzea/version.rb
CHANGED
data/lib/canzea.rb
CHANGED
@@ -16,6 +16,7 @@ require "commands/remote-bootstrap"
|
|
16
16
|
require "commands/gen-user"
|
17
17
|
require "commands/update-config"
|
18
18
|
require "commands/apply-config"
|
19
|
+
require "commands/add-env"
|
19
20
|
|
20
21
|
module Canzea
|
21
22
|
command = Cri::Command.define do
|
@@ -95,6 +96,12 @@ module Canzea
|
|
95
96
|
|
96
97
|
if (opts[:util])
|
97
98
|
util = opts[:util]
|
99
|
+
if (util == "add-env")
|
100
|
+
AddEnv.new.add(args[0], args[1])
|
101
|
+
end
|
102
|
+
if (util == "add-env-secret")
|
103
|
+
AddEnv.new.addSecret(args[0], args[1])
|
104
|
+
end
|
98
105
|
|
99
106
|
if (util == "gen-user")
|
100
107
|
GenUser.new.do(args[0])
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'plan-step-class'
|
3
|
+
|
4
|
+
class AddEnv
|
5
|
+
|
6
|
+
def add (key, value)
|
7
|
+
extraConfig = Canzea::config[:catalog_location] + "/env.json"
|
8
|
+
envs = loadFile()
|
9
|
+
envs["vars"][key] = value
|
10
|
+
File.write(extraConfig, JSON.generate(envs))
|
11
|
+
end
|
12
|
+
|
13
|
+
def addSecret (key, value)
|
14
|
+
extraConfig = Canzea::config[:catalog_location] + "/env.json"
|
15
|
+
envs = loadFile()
|
16
|
+
envs['secrets'][key] = value
|
17
|
+
File.write(extraConfig, JSON.generate(envs))
|
18
|
+
end
|
19
|
+
|
20
|
+
def loadFile()
|
21
|
+
extraConfig = Canzea::config[:catalog_location] + "/env.json"
|
22
|
+
if File.exists?(extraConfig)
|
23
|
+
file = File.read(extraConfig)
|
24
|
+
envs = JSON.parse(file)
|
25
|
+
else
|
26
|
+
envs = {"vars"=>{}, "secrets"=>{}}
|
27
|
+
end
|
28
|
+
return envs
|
29
|
+
end
|
30
|
+
|
31
|
+
def injectEnvironmentVariables()
|
32
|
+
extraConfig = Canzea::config[:catalog_location] + "/env.json"
|
33
|
+
if File.exists?(extraConfig)
|
34
|
+
puts "-- Reading #{extraConfig}"
|
35
|
+
file = File.read(extraConfig)
|
36
|
+
envs = JSON.parse(file)
|
37
|
+
envs['vars'].keys.each { | key |
|
38
|
+
val = envs['vars'][key]
|
39
|
+
puts "-- #{key} == #{val}"
|
40
|
+
ENV.store(key, val)
|
41
|
+
}
|
42
|
+
envs['secrets'].keys.each { | key |
|
43
|
+
val = envs['secrets'][key]
|
44
|
+
puts "-- #{key} == XXXXXX"
|
45
|
+
ENV.store(key, val)
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'commands/add-env'
|
2
3
|
require 'plan-step-class'
|
3
4
|
|
4
5
|
class ApplyConfig
|
@@ -14,7 +15,7 @@ class ApplyConfig
|
|
14
15
|
index = 1
|
15
16
|
steps["steps"].each { | step |
|
16
17
|
|
17
|
-
injectEnvironmentVariables()
|
18
|
+
AddEnv.new.injectEnvironmentVariables()
|
18
19
|
|
19
20
|
role = step['role']
|
20
21
|
solution = step['solution']
|
@@ -28,18 +29,4 @@ class ApplyConfig
|
|
28
29
|
}
|
29
30
|
end
|
30
31
|
|
31
|
-
def injectEnvironmentVariables()
|
32
|
-
extraConfig = Canzea::config[:catalog_location] + "/env.json"
|
33
|
-
if File.exists?(extraConfig)
|
34
|
-
puts "-- Reading #{extraConfig}"
|
35
|
-
file = File.read(extraConfig)
|
36
|
-
envs = JSON.parse(file)
|
37
|
-
envs.keys.each { | key |
|
38
|
-
puts "#{key} == #{envs[key]}"
|
39
|
-
ENV.store(key, envs[key])
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canzea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Canzea Technologies
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- lib/canzea/config.rb
|
166
166
|
- lib/canzea/environment.rb
|
167
167
|
- lib/canzea/version.rb
|
168
|
+
- lib/commands/add-env.rb
|
168
169
|
- lib/commands/apply-config.rb
|
169
170
|
- lib/commands/config-git-commit.rb
|
170
171
|
- lib/commands/gen-user.rb
|