firespring_dev_commands 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44213627e63b15337ede6416bf7dc17e6f70188d71ca2f2a19b601e61b21ae0e
|
4
|
+
data.tar.gz: 356826da99f48dcaa041afe7afa642fdb18f72b38536b2a46753fd0a336508fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b6e69d0bd7625fd033e528322d8d61512abdc3d1cd0637d295eeba000a65e8d55808a89c44c093fb09d136c6cba62a9641db4d30e54e0e248197a25693ca5e
|
7
|
+
data.tar.gz: 0b3f4c05a9d1900179e2bd8cc7322390243a990cf04ca48963508af32dc54e6f469dc4bb151af2ce4968a371fc2e387e554db80f4f23a79dc9deeff2ea78fafc
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Dev
|
2
|
+
class Common
|
3
|
+
class Platform
|
4
|
+
ALLOWED_ARCHITECTURES = %w(arm64 amd64).freeze
|
5
|
+
|
6
|
+
def determine_compute_architecture
|
7
|
+
case RUBY_PLATFORM
|
8
|
+
when /x86_64|amd64/
|
9
|
+
'linux/amd64' # 64-bit Intel/AMD architecture
|
10
|
+
when /arm|aarch64/
|
11
|
+
'linux/arm64' # ARM architecture
|
12
|
+
else
|
13
|
+
raise 'Unknown or unsupported architecture'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def architecture
|
18
|
+
docker_architecture = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
|
19
|
+
if docker_architecture.empty?
|
20
|
+
determine_compute_architecture
|
21
|
+
else
|
22
|
+
raise "Missing 'linux/' prefix in DOCKER_ARCHITECTURE: #{docker_architecture}" unless docker_architecture.start_with?('linux/')
|
23
|
+
|
24
|
+
architecture_name = docker_architecture.split('/')[1]
|
25
|
+
|
26
|
+
unless ALLOWED_ARCHITECTURES.include?(architecture_name)
|
27
|
+
raise "Invalid DOCKER_ARCHITECTURE: #{architecture_name}. Allowed architectures are #{ALLOWED_ARCHITECTURES.join(', ')}"
|
28
|
+
end
|
29
|
+
|
30
|
+
docker_architecture
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -6,14 +6,11 @@ module Dev
|
|
6
6
|
class Application
|
7
7
|
# Contains rake tasks for displaying and setting application variables in parameter store
|
8
8
|
class Config < Dev::Template::ApplicationInterface
|
9
|
-
attr_reader :
|
10
|
-
|
11
|
-
# Allow for custom config path_prefix for the application
|
12
|
-
# Allow for custom key parameter path (otherwise base it off the path prefix)
|
13
|
-
def initialize(name, path_prefix, key_parameter_path: nil, exclude: [])
|
14
|
-
@path_prefix = path_prefix
|
15
|
-
@key_parameter_path = key_parameter_path || "#{path_prefix}/kms/id"
|
9
|
+
attr_reader :path
|
16
10
|
|
11
|
+
# Allow for custom config path for the application
|
12
|
+
def initialize(name, path, exclude: [])
|
13
|
+
@path = path
|
17
14
|
super(name, exclude:)
|
18
15
|
end
|
19
16
|
|
@@ -21,7 +18,7 @@ module Dev
|
|
21
18
|
def create_list_task!
|
22
19
|
# Have to set a local variable to be accessible inside of the instance_eval block
|
23
20
|
application = @name
|
24
|
-
|
21
|
+
path = @path
|
25
22
|
exclude = @exclude
|
26
23
|
|
27
24
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -32,10 +29,8 @@ module Dev
|
|
32
29
|
desc "List all #{application} configs"
|
33
30
|
task list: %w(init) do
|
34
31
|
puts
|
35
|
-
|
36
|
-
|
37
|
-
Dev::Aws::Parameter.new.list(path_prefix).each do |it|
|
38
|
-
puts " #{it.name.light_white} => #{it.value.light_white} (#{it.type})"
|
32
|
+
Dev::Aws::Parameter.new.list(path).each do |it|
|
33
|
+
puts " #{it.name} => #{it.value} (#{it.type})"
|
39
34
|
end
|
40
35
|
puts
|
41
36
|
end
|
@@ -49,8 +44,7 @@ module Dev
|
|
49
44
|
def create_set_task!
|
50
45
|
# Have to set a local variable to be accessible inside of the instance_eval block
|
51
46
|
application = @name
|
52
|
-
|
53
|
-
key_parameter_path = @key_parameter_path
|
47
|
+
path = @path
|
54
48
|
exclude = @exclude
|
55
49
|
|
56
50
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -64,7 +58,7 @@ module Dev
|
|
64
58
|
"\n\toptionally specify ENCRYPT=true to change a String type to a SecureString type"
|
65
59
|
task set: %w(ensure_aws_credentials) do
|
66
60
|
raise 'NAME is required' if ENV['NAME'].to_s.strip.blank?
|
67
|
-
raise 'NAME is not found in this apps parameters' if Dev::Aws::Parameter.new.list(
|
61
|
+
raise 'NAME is not found in this apps parameters' if Dev::Aws::Parameter.new.list(path).none? { |it| it.name == ENV['NAME'] }
|
68
62
|
raise 'VALUE is required' if ENV['VALUE'].to_s.strip.blank?
|
69
63
|
|
70
64
|
param_path = ENV.fetch('NAME', nil)
|
@@ -74,7 +68,7 @@ module Dev
|
|
74
68
|
params = {type: 'String'}
|
75
69
|
if ENV['ENCRYPT'].to_s.strip == 'true' || old_value.type == 'SecureString'
|
76
70
|
params[:type] = 'SecureString'
|
77
|
-
params[:key_id] = Dev::Aws::Parameter.new.get_value(
|
71
|
+
params[:key_id] = Dev::Aws::Parameter.new.get_value("#{path}/kms/id")
|
78
72
|
end
|
79
73
|
|
80
74
|
message = 'This will change '.light_green +
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firespring_dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
@@ -293,6 +293,7 @@ files:
|
|
293
293
|
- lib/firespring_dev_commands/node/audit.rb
|
294
294
|
- lib/firespring_dev_commands/php.rb
|
295
295
|
- lib/firespring_dev_commands/php/audit.rb
|
296
|
+
- lib/firespring_dev_commands/platform.rb
|
296
297
|
- lib/firespring_dev_commands/rake.rb
|
297
298
|
- lib/firespring_dev_commands/ruby.rb
|
298
299
|
- lib/firespring_dev_commands/ruby/audit.rb
|