jets 1.9.18 → 1.9.19
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/CHANGELOG.md +4 -0
- data/lib/jets/application.rb +1 -59
- data/lib/jets/application/{default_config.rb → defaults.rb} +76 -1
- data/lib/jets/commands/templates/skeleton/config/application.rb.tt +2 -2
- data/lib/jets/dotenv.rb +9 -7
- data/lib/jets/resource/api_gateway/rest_api/routes/collision.rb +1 -1
- data/lib/jets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '06684dfe45f0cb90c0809eb24f3bcb36f8dfbd4c5e1c69fcf46eb86c140325a4'
|
4
|
+
data.tar.gz: 8e5a0ff622207135ae9013d6ab300db68bb3ffbbaa368641e248937992c6e932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd974cacee0866e00091a817ba4e7e2b476674ff096e8b3139da5b35fcf24fa237a69ee77d9ac981b2582bca135042137eee3ab37449e788b6937ea43ef2e11e
|
7
|
+
data.tar.gz: 82ffb01f43d6261220c96d329a7a26ddc1439c27c341460dc8d2de32c4b59f8507aa6a6c7291f1ed4a5439782546f5bdea7442b5906cb3d9d415b2a54b838c6a
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [1.9.19]
|
7
|
+
- #295 dotenv env extra support, fix precedence again
|
8
|
+
- #296 automatically add vpc permissions when using vpc_config at the application-wide iam level
|
9
|
+
|
6
10
|
## [1.9.18]
|
7
11
|
- #233 SSM Parameter Store support for dotenv files
|
8
12
|
- #293 Improvements to SSM Parameter Store support
|
data/lib/jets/application.rb
CHANGED
@@ -5,7 +5,7 @@ class Jets::Application
|
|
5
5
|
include Singleton
|
6
6
|
extend Memoist
|
7
7
|
include Jets::Middleware
|
8
|
-
include
|
8
|
+
include Defaults
|
9
9
|
|
10
10
|
def configure(&block)
|
11
11
|
instance_eval(&block) if block
|
@@ -108,33 +108,6 @@ class Jets::Application
|
|
108
108
|
loader.setup
|
109
109
|
end
|
110
110
|
|
111
|
-
# Essentially folders under app folder will be the default_autoload_paths. Example:
|
112
|
-
# app/controllers
|
113
|
-
# app/helpers
|
114
|
-
# app/jobs
|
115
|
-
# app/models
|
116
|
-
# app/rules
|
117
|
-
# app/shared/resources
|
118
|
-
#
|
119
|
-
# Also include:
|
120
|
-
# app/models/concerns
|
121
|
-
# app/controllers/concerns
|
122
|
-
def default_autoload_paths
|
123
|
-
paths = []
|
124
|
-
each_app_autoload_path("#{Jets.root}/app/*") do |path|
|
125
|
-
paths << path
|
126
|
-
end
|
127
|
-
# Handle concerns folders
|
128
|
-
each_app_autoload_path("#{Jets.root}/app/**/concerns") do |path|
|
129
|
-
paths << path
|
130
|
-
end
|
131
|
-
|
132
|
-
paths << "#{Jets.root}/app/shared/resources"
|
133
|
-
paths << "#{Jets.root}/app/shared/extensions"
|
134
|
-
|
135
|
-
paths
|
136
|
-
end
|
137
|
-
|
138
111
|
def each_app_autoload_path(expression)
|
139
112
|
Dir.glob(expression).each do |p|
|
140
113
|
p.sub!('./','')
|
@@ -189,37 +162,6 @@ class Jets::Application
|
|
189
162
|
config.managed_policy_definitions ||= [] # default empty
|
190
163
|
end
|
191
164
|
|
192
|
-
def self.default_iam_policy
|
193
|
-
project_namespace = Jets.project_namespace
|
194
|
-
logs = {
|
195
|
-
action: ["logs:*"],
|
196
|
-
effect: "Allow",
|
197
|
-
resource: "arn:aws:logs:#{Jets.aws.region}:#{Jets.aws.account}:log-group:/aws/lambda/#{project_namespace}-*",
|
198
|
-
}
|
199
|
-
s3_bucket = Jets.aws.s3_bucket
|
200
|
-
s3_readonly = {
|
201
|
-
action: ["s3:Get*", "s3:List*"],
|
202
|
-
effect: "Allow",
|
203
|
-
resource: "arn:aws:s3:::#{s3_bucket}*",
|
204
|
-
}
|
205
|
-
s3_bucket = {
|
206
|
-
action: ["s3:ListAllMyBuckets", "s3:HeadBucket"],
|
207
|
-
effect: "Allow",
|
208
|
-
resource: "arn:aws:s3:::*", # scoped to all buckets
|
209
|
-
}
|
210
|
-
policies = [logs, s3_readonly, s3_bucket]
|
211
|
-
|
212
|
-
if Jets::Stack.has_resources?
|
213
|
-
cloudformation = {
|
214
|
-
action: ["cloudformation:DescribeStacks"],
|
215
|
-
effect: "Allow",
|
216
|
-
resource: "arn:aws:cloudformation:#{Jets.aws.region}:#{Jets.aws.account}:stack/#{project_namespace}*",
|
217
|
-
}
|
218
|
-
policies << cloudformation
|
219
|
-
end
|
220
|
-
policies
|
221
|
-
end
|
222
|
-
|
223
165
|
# It is pretty easy to attempt to set environment variables without
|
224
166
|
# the correct AWS Environment.Variables path struture.
|
225
167
|
# Auto-fix it for convenience.
|
@@ -1,5 +1,53 @@
|
|
1
1
|
class Jets::Application
|
2
|
-
module
|
2
|
+
module Defaults
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
def self.default_iam_policy
|
7
|
+
project_namespace = Jets.project_namespace
|
8
|
+
logs = {
|
9
|
+
action: ["logs:*"],
|
10
|
+
effect: "Allow",
|
11
|
+
resource: "arn:aws:logs:#{Jets.aws.region}:#{Jets.aws.account}:log-group:/aws/lambda/#{project_namespace}-*",
|
12
|
+
}
|
13
|
+
s3_bucket = Jets.aws.s3_bucket
|
14
|
+
s3_readonly = {
|
15
|
+
action: ["s3:Get*", "s3:List*"],
|
16
|
+
effect: "Allow",
|
17
|
+
resource: "arn:aws:s3:::#{s3_bucket}*",
|
18
|
+
}
|
19
|
+
s3_bucket = {
|
20
|
+
action: ["s3:ListAllMyBuckets", "s3:HeadBucket"],
|
21
|
+
effect: "Allow",
|
22
|
+
resource: "arn:aws:s3:::*", # scoped to all buckets
|
23
|
+
}
|
24
|
+
policies = [logs, s3_readonly, s3_bucket]
|
25
|
+
|
26
|
+
if Jets::Stack.has_resources?
|
27
|
+
cloudformation = {
|
28
|
+
action: ["cloudformation:DescribeStacks"],
|
29
|
+
effect: "Allow",
|
30
|
+
resource: "arn:aws:cloudformation:#{Jets.aws.region}:#{Jets.aws.account}:stack/#{project_namespace}*",
|
31
|
+
}
|
32
|
+
policies << cloudformation
|
33
|
+
end
|
34
|
+
|
35
|
+
if Jets.config.function.vpc_config
|
36
|
+
vpc = %w[
|
37
|
+
ec2:CreateNetworkInterface
|
38
|
+
ec2:DeleteNetworkInterface
|
39
|
+
ec2:DescribeNetworkInterfaces
|
40
|
+
ec2:DescribeVpcs
|
41
|
+
ec2:DescribeSubnets
|
42
|
+
ec2:DescribeSecurityGroups
|
43
|
+
]
|
44
|
+
policies += vpc
|
45
|
+
end
|
46
|
+
|
47
|
+
policies
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
3
51
|
def default_config
|
4
52
|
config = ActiveSupport::OrderedOptions.new
|
5
53
|
config.project_name = parse_project_name # must set early because other configs requires this
|
@@ -91,5 +139,32 @@ class Jets::Application
|
|
91
139
|
|
92
140
|
config
|
93
141
|
end
|
142
|
+
|
143
|
+
# Essentially folders under app folder will be the default_autoload_paths. Example:
|
144
|
+
# app/controllers
|
145
|
+
# app/helpers
|
146
|
+
# app/jobs
|
147
|
+
# app/models
|
148
|
+
# app/rules
|
149
|
+
# app/shared/resources
|
150
|
+
#
|
151
|
+
# Also include:
|
152
|
+
# app/models/concerns
|
153
|
+
# app/controllers/concerns
|
154
|
+
def default_autoload_paths
|
155
|
+
paths = []
|
156
|
+
each_app_autoload_path("#{Jets.root}/app/*") do |path|
|
157
|
+
paths << path
|
158
|
+
end
|
159
|
+
# Handle concerns folders
|
160
|
+
each_app_autoload_path("#{Jets.root}/app/**/concerns") do |path|
|
161
|
+
paths << path
|
162
|
+
end
|
163
|
+
|
164
|
+
paths << "#{Jets.root}/app/shared/resources"
|
165
|
+
paths << "#{Jets.root}/app/shared/extensions"
|
166
|
+
|
167
|
+
paths
|
168
|
+
end
|
94
169
|
end
|
95
170
|
end
|
@@ -32,8 +32,8 @@ Jets.application.configure do
|
|
32
32
|
# More examples:
|
33
33
|
# config.function.dead_letter_config = { target_arn: "arn" }
|
34
34
|
# config.function.vpc_config = {
|
35
|
-
# security_group_ids: [
|
36
|
-
# subnet_ids: [
|
35
|
+
# security_group_ids: %w[sg-1 sg-2],
|
36
|
+
# subnet_ids: %w[subnet-1 subnet-2],
|
37
37
|
# }
|
38
38
|
# The config.function settings to the CloudFormation Lambda Function properties.
|
39
39
|
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
|
data/lib/jets/dotenv.rb
CHANGED
@@ -6,23 +6,22 @@ class Jets::Dotenv
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def initialize(remote=false)
|
9
|
-
@remote = remote
|
10
|
-
@remote = ENV['JETS_ENV_REMOTE'] if ENV['JETS_ENV_REMOTE']
|
9
|
+
@remote = ENV['JETS_ENV_REMOTE'] || remote
|
11
10
|
end
|
12
11
|
|
13
12
|
def load!
|
14
13
|
vars = ::Dotenv.load(*dotenv_files)
|
15
|
-
|
16
|
-
ssm.interpolate!
|
14
|
+
Ssm.new(vars).interpolate!
|
17
15
|
end
|
18
16
|
|
19
17
|
# dotenv files with the following precedence:
|
20
18
|
#
|
21
|
-
# - .env.development.
|
19
|
+
# - .env.development.jets_env_extra (highest)
|
20
|
+
# - .env.development.remote (2nd highest)
|
22
21
|
# - .env.development.local
|
23
22
|
# - .env.development
|
24
23
|
# - .env.local - This file is loaded for all environments _except_ `test`.
|
25
|
-
# - .env
|
24
|
+
# - .env - The original (lowest)
|
26
25
|
#
|
27
26
|
def dotenv_files
|
28
27
|
files = [
|
@@ -32,7 +31,10 @@ class Jets::Dotenv
|
|
32
31
|
root.join(".env.#{Jets.env}.local"),
|
33
32
|
]
|
34
33
|
files << root.join(".env.#{Jets.env}.remote") if @remote
|
35
|
-
|
34
|
+
if ENV["JETS_ENV_EXTRA"]
|
35
|
+
files << root.join(".env.#{Jets.env}.#{ENV["JETS_ENV_EXTRA"]}")
|
36
|
+
end
|
37
|
+
files.compact
|
36
38
|
end
|
37
39
|
|
38
40
|
def root
|
@@ -33,7 +33,7 @@ class Jets::Resource::ApiGateway::RestApi::Routes
|
|
33
33
|
Example: /posts/:id and /posts/:post_id/reveal should both be /posts/:id and /posts/:id/reveal.
|
34
34
|
|
35
35
|
Please check your `config/routes.rb` and remove the colliding routes.
|
36
|
-
More info: http://rubyonjets.com/docs/considerations
|
36
|
+
More info: http://rubyonjets.com/docs/considerations/api-gateway/
|
37
37
|
EOL
|
38
38
|
end
|
39
39
|
|
data/lib/jets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
@@ -578,7 +578,7 @@ files:
|
|
578
578
|
- jets.gemspec
|
579
579
|
- lib/jets.rb
|
580
580
|
- lib/jets/application.rb
|
581
|
-
- lib/jets/application/
|
581
|
+
- lib/jets/application/defaults.rb
|
582
582
|
- lib/jets/autoloaders.rb
|
583
583
|
- lib/jets/aws_info.rb
|
584
584
|
- lib/jets/aws_services.rb
|