exercism-config 0.51.0 → 0.56.0
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/README.md +7 -1
- data/bin/setup_exercism_config +14 -6
- data/bin/setup_exercism_local_aws +8 -7
- data/exercism_config.gemspec +1 -1
- data/lib/exercism_config/retrieve_config.rb +2 -3
- data/lib/exercism_config/retrieve_secrets.rb +5 -5
- data/lib/exercism_config/version.rb +1 -1
- data/settings/secrets.yml +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c955fbfc003d784f274dabab804fa47c9e650a9377e6ae27d500b792a3b4d4
|
4
|
+
data.tar.gz: 5b242eddb88013e13cec926c47f9b2c4d96f0bd1f04561c28730798535be0680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d39665cd20bba4db82995357ebfe5eb430ba11f8a8b4640dfa620d6736accc3138ebda253b36d3266c7c3f6bc788c18af6c266c63a51ef9dade00e398e9c32ca
|
7
|
+
data.tar.gz: bbb85e8979746b342f5b923719e172addb3e6cfcd56d4a5cf1ecc4d1feb942cd09ad7b79812b0da88d3cc34b8fa5f7450f4bdbba51789386d33ab14e375ea232
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
## Usage
|
9
9
|
|
10
|
-
This gem provides you with the following config and
|
10
|
+
This gem provides you with the following config, secrets and helper methods:
|
11
11
|
|
12
12
|
```ruby
|
13
13
|
# Config
|
@@ -27,8 +27,14 @@ Exercism.config.language_server_url
|
|
27
27
|
# Secrets
|
28
28
|
Exercism.secrets.github_omniauth_app_id
|
29
29
|
Exercism.secrets.github_omniauth_app_secret
|
30
|
+
Exercism.secrets.github_webhooks_secret
|
30
31
|
Exercism.secrets.hcaptcha_site_key
|
31
32
|
Exercism.secrets.hcaptcha_secret
|
33
|
+
|
34
|
+
# Helper methods (create new clients)
|
35
|
+
Exercism.dynamodb_client
|
36
|
+
Exercism.s3_client
|
37
|
+
Exercism.ecr_client
|
32
38
|
```
|
33
39
|
|
34
40
|
## Explaination
|
data/bin/setup_exercism_config
CHANGED
@@ -32,7 +32,7 @@ def create_dynamodb_table
|
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
35
|
-
def delete_table
|
35
|
+
def delete_table
|
36
36
|
Exercism.dynamodb_client.delete_table(
|
37
37
|
table_name: :config
|
38
38
|
)
|
@@ -84,9 +84,17 @@ secrets_file = File.expand_path('../settings/secrets.yml', __dir__)
|
|
84
84
|
puts "Using secrets file: #{secrets_file}"
|
85
85
|
secrets_json = YAML.load(ERB.new(File.read(secrets_file)).result).to_json
|
86
86
|
|
87
|
+
secret_name = "config"
|
87
88
|
secrets_client = Aws::SecretsManager::Client.new(ExercismConfig::GenerateAwsSettings.())
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
begin
|
90
|
+
secrets_client.create_secret(
|
91
|
+
description: "Exercism Config used secrets",
|
92
|
+
name: secret_name,
|
93
|
+
secret_string: secrets_json
|
94
|
+
)
|
95
|
+
rescue Aws::SecretsManager::Errors::ResourceExistsException
|
96
|
+
secrets_client.update_secret(
|
97
|
+
secret_id: secret_name,
|
98
|
+
secret_string: secrets_json
|
99
|
+
)
|
100
|
+
end
|
@@ -6,7 +6,6 @@ require "exercism-config"
|
|
6
6
|
return if Exercism.env.production?
|
7
7
|
|
8
8
|
puts "Create AWS/DynamoDB tables..."
|
9
|
-
|
10
9
|
##################
|
11
10
|
# Setup local s3 #
|
12
11
|
##################
|
@@ -18,6 +17,8 @@ unless ENV["EXERCISM_SKIP_S3"]
|
|
18
17
|
].each do |bucket|
|
19
18
|
begin
|
20
19
|
Exercism.s3_client.create_bucket(bucket: bucket)
|
20
|
+
rescue Aws::S3::Errors::BucketAlreadyExists
|
21
|
+
# Bucket already exists
|
21
22
|
rescue Seahorse::Client::NetworkingError => e
|
22
23
|
puts "local S3 not up yet..."
|
23
24
|
sleep 2 # slighty retry delaty
|
@@ -34,14 +35,14 @@ end
|
|
34
35
|
Exercism.config.dynamodb_tooling_jobs_table + "-test"
|
35
36
|
].each do |table_name|
|
36
37
|
begin
|
37
|
-
Exercism.
|
38
|
+
Exercism.dynamodb_client.delete_table(
|
38
39
|
table_name: table_name
|
39
40
|
)
|
40
41
|
rescue Aws::DynamoDB::Errors::ResourceNotFoundException
|
41
42
|
end
|
42
43
|
puts "[x] #{table_name}"
|
43
44
|
|
44
|
-
Exercism.
|
45
|
+
Exercism.dynamodb_client.create_table(
|
45
46
|
table_name: table_name,
|
46
47
|
attribute_definitions: [
|
47
48
|
{
|
@@ -61,7 +62,7 @@ end
|
|
61
62
|
}
|
62
63
|
)
|
63
64
|
|
64
|
-
Exercism.
|
65
|
+
Exercism.dynamodb_client.update_table(
|
65
66
|
table_name: table_name,
|
66
67
|
attribute_definitions: [
|
67
68
|
{
|
@@ -99,7 +100,7 @@ end
|
|
99
100
|
]
|
100
101
|
)
|
101
102
|
|
102
|
-
Exercism.
|
103
|
+
Exercism.dynamodb_client.update_table(
|
103
104
|
table_name: table_name,
|
104
105
|
attribute_definitions: [
|
105
106
|
{
|
@@ -147,14 +148,14 @@ end
|
|
147
148
|
Exercism.config.dynamodb_tooling_language_groups_table + "-test"
|
148
149
|
].each do |table_name|
|
149
150
|
begin
|
150
|
-
Exercism.
|
151
|
+
Exercism.dynamodb_client.delete_table(
|
151
152
|
table_name: table_name
|
152
153
|
)
|
153
154
|
rescue Aws::DynamoDB::Errors::ResourceNotFoundException
|
154
155
|
end
|
155
156
|
puts "[x] #{table_name}"
|
156
157
|
|
157
|
-
Exercism.
|
158
|
+
Exercism.dynamodb_client.create_table(
|
158
159
|
table_name: table_name,
|
159
160
|
attribute_definitions: [
|
160
161
|
{
|
data/exercism_config.gemspec
CHANGED
@@ -38,6 +38,6 @@ Gem::Specification.new do |spec|
|
|
38
38
|
# This isn't a compulsary dependency
|
39
39
|
# but can be used if someone puts it in their
|
40
40
|
# own Gemfile when using this.
|
41
|
-
spec.add_development_dependency 'aws-sdk-s3'
|
42
41
|
spec.add_development_dependency 'aws-sdk-ecr'
|
42
|
+
spec.add_development_dependency 'aws-sdk-s3'
|
43
43
|
end
|
@@ -3,13 +3,13 @@ module ExercismConfig
|
|
3
3
|
include Mandate
|
4
4
|
|
5
5
|
def call
|
6
|
-
return
|
6
|
+
return use_non_production_settings unless Exercism.env.production?
|
7
7
|
|
8
8
|
retrieve_from_dynamodb
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
|
-
def
|
12
|
+
def use_non_production_settings
|
13
13
|
require 'erb'
|
14
14
|
require 'yaml'
|
15
15
|
|
@@ -43,6 +43,5 @@ module ExercismConfig
|
|
43
43
|
'local'
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
47
46
|
end
|
48
47
|
end
|
@@ -3,20 +3,20 @@ module ExercismConfig
|
|
3
3
|
include Mandate
|
4
4
|
|
5
5
|
def call
|
6
|
-
return
|
6
|
+
return use_non_production_settings unless Exercism.env.production?
|
7
7
|
|
8
8
|
retrieve_from_aws
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
|
-
def
|
12
|
+
def use_non_production_settings
|
13
13
|
require 'erb'
|
14
14
|
require 'yaml'
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
secrets_file = File.expand_path('../../settings/secrets.yml', __dir__)
|
17
|
+
secrets = YAML.safe_load(ERB.new(File.read(secrets_file)).result)
|
18
18
|
|
19
|
-
Exercism::
|
19
|
+
Exercism::Secrets.new(secrets)
|
20
20
|
end
|
21
21
|
|
22
22
|
def retrieve_from_aws
|
data/settings/secrets.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exercism-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.56.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '12.3'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: aws-sdk-
|
126
|
+
name: aws-sdk-ecr
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name: aws-sdk-
|
140
|
+
name: aws-sdk-s3
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|