exercism-config 0.48.0 → 0.53.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/.github/workflows/rubocop.yml +1 -1
- data/.github/workflows/tests.yml +7 -18
- data/README.md +39 -1
- data/bin/setup_exercism_config +29 -12
- data/bin/setup_exercism_local_aws +9 -10
- data/exercism_config.gemspec +4 -2
- data/lib/exercism-config.rb +27 -7
- data/lib/exercism/secrets.rb +4 -0
- data/lib/exercism_config/determine_environment.rb +1 -3
- data/lib/exercism_config/generate_aws_settings.rb +7 -3
- data/lib/exercism_config/{retrieve.rb → retrieve_config.rb} +12 -24
- data/lib/exercism_config/retrieve_secrets.rb +30 -0
- data/lib/exercism_config/setup_dynamodb_client.rb +2 -18
- data/lib/exercism_config/setup_ecr_client.rb +2 -9
- data/lib/exercism_config/setup_s3_client.rb +2 -21
- data/lib/exercism_config/version.rb +1 -1
- data/settings/ci.yml +1 -1
- data/settings/docker.yml +1 -1
- data/settings/local.yml +3 -3
- data/settings/secrets.yml +4 -0
- metadata +35 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b4188dd389760a20d284cf858bae3a8c5cb2226d25a2ebb706379a2d7ee190d
|
4
|
+
data.tar.gz: a9d689610218fbbebb9d79b2d1e829e513108adeef3ef9f1c41429caeae01fb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcb1fb3b17ae426c88743fa0426a201e38d6c334567a8524c4357ebc280639d002974683f8d7c9d70a122a5990d51c3922e6e31ec3e7fe9ae06cf3b672dd3db7
|
7
|
+
data.tar.gz: 1441485d22fcd440909630a2deafb126e9e4628d803660ddb8087daed84c0281cd9dfc9881d1cc5c09f1a3fb79e56bf6253c14248e4affee0575a7cfa6dfb1b9
|
data/.github/workflows/tests.yml
CHANGED
@@ -11,10 +11,10 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
|
13
13
|
services:
|
14
|
-
|
15
|
-
image: "
|
14
|
+
aws:
|
15
|
+
image: "localstack/localstack"
|
16
16
|
ports:
|
17
|
-
-
|
17
|
+
- 4566
|
18
18
|
|
19
19
|
steps:
|
20
20
|
###
|
@@ -24,19 +24,10 @@ jobs:
|
|
24
24
|
###
|
25
25
|
# Setup Ruby - this needs to match the version in the Gemfile
|
26
26
|
- name: Set up Ruby
|
27
|
-
uses: ruby/setup-ruby@
|
27
|
+
uses: ruby/setup-ruby@a699edbce608a2c128dedad88e3b6a0e28687b3c
|
28
28
|
with:
|
29
29
|
ruby-version: 2.6.6
|
30
|
-
|
31
|
-
###
|
32
|
-
# Caching using GitHub's caching action
|
33
|
-
- name: Cache Bundler
|
34
|
-
uses: actions/cache@v2
|
35
|
-
with:
|
36
|
-
path: vendor/bundle
|
37
|
-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
38
|
-
restore-keys: |
|
39
|
-
${{ runner.os }}-gems-
|
30
|
+
bundler-cache: true
|
40
31
|
|
41
32
|
###
|
42
33
|
# Install bundler and yarn dependencies
|
@@ -44,10 +35,8 @@ jobs:
|
|
44
35
|
env:
|
45
36
|
EXERCISM_ENV: test
|
46
37
|
EXERCISM_CI: true
|
47
|
-
|
38
|
+
AWS_PORT: ${{ job.services.aws.ports['4566'] }}
|
48
39
|
run: |
|
49
|
-
bundle config path vendor/bundle # This is needed for the caching above
|
50
|
-
bundle install --jobs 4 --retry 3
|
51
40
|
bundle exec setup_exercism_config
|
52
41
|
|
53
42
|
###
|
@@ -64,7 +53,7 @@ jobs:
|
|
64
53
|
env:
|
65
54
|
EXERCISM_ENV: test
|
66
55
|
EXERCISM_CI: true
|
67
|
-
|
56
|
+
AWS_PORT: ${{ job.services.aws.ports['4566'] }}
|
68
57
|
CAPTURE_CODE_COVERAGE: true
|
69
58
|
run: |
|
70
59
|
bundle exec rake test
|
data/README.md
CHANGED
@@ -5,11 +5,49 @@
|
|
5
5
|
[](https://codeclimate.com/github/exercism/config/test_coverage)
|
6
6
|
[](https://badge.fury.io/rb/exercism-config)
|
7
7
|
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
This gem provides you with the following config and secrets:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
# Config
|
14
|
+
|
15
|
+
Exercism.config.anycable_redis_url
|
16
|
+
Exercism.config.anycable_rpc_host
|
17
|
+
Exercism.config.aws_submissions_bucket
|
18
|
+
Exercism.config.aws_tooling_jobs_bucket
|
19
|
+
Exercism.config.dynamodb_tooling_jobs_table
|
20
|
+
Exercism.config.dynamodb_tooling_language_groups_table
|
21
|
+
Exercism.config.mysql_master_endpoint
|
22
|
+
Exercism.config.mysql_port
|
23
|
+
Exercism.config.spi_url
|
24
|
+
Exercism.config.tooling_orchestrator_url
|
25
|
+
Exercism.config.language_server_url
|
26
|
+
|
27
|
+
# Secrets
|
28
|
+
Exercism.secrets.github_omniauth_app_id
|
29
|
+
Exercism.secrets.github_omniauth_app_secret
|
30
|
+
Exercism.secrets.hcaptcha_site_key
|
31
|
+
Exercism.secrets.hcaptcha_secret
|
32
|
+
```
|
33
|
+
|
34
|
+
## Explaination
|
35
|
+
|
8
36
|
When terraform creates Exercism's infrastructure, it writes endpoints and DNS entries to DynamoDB.
|
9
37
|
This gem allows you to trivially retrieve that data.
|
10
38
|
|
11
39
|
When running on AWS, simply ensure the machine has read-access to the relevant table (currently hardcoded to `config`).
|
12
|
-
|
40
|
+
|
41
|
+
## Local AWS
|
42
|
+
|
43
|
+
This requires a local version of AWS to work.
|
44
|
+
We use localstack for this.
|
45
|
+
If you use the development-environment this will be handled for you.
|
46
|
+
If not, to start localstack use the following:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
docker run -dp 3042:8080 -p 3040:4566 -p 3041:4566 localstack/localstack
|
50
|
+
```
|
13
51
|
|
14
52
|
## Usage
|
15
53
|
|
data/bin/setup_exercism_config
CHANGED
@@ -10,8 +10,8 @@ if Exercism.env.production?
|
|
10
10
|
exit
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def create_dynamodb_table
|
14
|
+
Exercism.dynamodb_client.create_table(
|
15
15
|
table_name: :config,
|
16
16
|
attribute_definitions: [
|
17
17
|
{
|
@@ -32,14 +32,14 @@ def create_table(client)
|
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
35
|
-
def delete_table
|
36
|
-
|
35
|
+
def delete_table
|
36
|
+
Exercism.dynamodb_client.delete_table(
|
37
37
|
table_name: :config
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
41
|
-
def set_config_value(
|
42
|
-
|
41
|
+
def set_config_value(id, value)
|
42
|
+
Exercism.dynamodb_client.put_item(
|
43
43
|
table_name: :config,
|
44
44
|
item: {
|
45
45
|
id: id,
|
@@ -48,15 +48,13 @@ def set_config_value(client, id, value)
|
|
48
48
|
)
|
49
49
|
end
|
50
50
|
|
51
|
-
client = ExercismConfig::SetupDynamoDBClient.call
|
52
|
-
|
53
51
|
begin
|
54
|
-
|
52
|
+
create_dynamodb_table
|
55
53
|
rescue Aws::DynamoDB::Errors::ResourceInUseException => e
|
56
54
|
if ARGV.include?('--force')
|
57
55
|
puts 'Table exists. Recreating...'
|
58
|
-
delete_table
|
59
|
-
|
56
|
+
delete_table
|
57
|
+
create_dynamodb_table
|
60
58
|
puts 'Table recreated.'
|
61
59
|
else
|
62
60
|
puts 'Table exists. Not recreating.'
|
@@ -79,5 +77,24 @@ puts "Using settings file: #{settings_file}"
|
|
79
77
|
settings = YAML.load(ERB.new(File.read(settings_file)).result)
|
80
78
|
|
81
79
|
settings.each do |key, value|
|
82
|
-
set_config_value(
|
80
|
+
set_config_value(key, value)
|
81
|
+
end
|
82
|
+
|
83
|
+
secrets_file = File.expand_path('../settings/secrets.yml', __dir__)
|
84
|
+
puts "Using secrets file: #{secrets_file}"
|
85
|
+
secrets_json = YAML.load(ERB.new(File.read(secrets_file)).result).to_json
|
86
|
+
|
87
|
+
secret_name = "config"
|
88
|
+
secrets_client = Aws::SecretsManager::Client.new(ExercismConfig::GenerateAwsSettings.())
|
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
|
+
)
|
83
100
|
end
|
@@ -6,9 +6,6 @@ require "exercism-config"
|
|
6
6
|
return if Exercism.env.production?
|
7
7
|
|
8
8
|
puts "Create AWS/DynamoDB tables..."
|
9
|
-
|
10
|
-
Exercism.config.dynamodb_client = ExercismConfig::SetupDynamoDBClient.()
|
11
|
-
|
12
9
|
##################
|
13
10
|
# Setup local s3 #
|
14
11
|
##################
|
@@ -19,7 +16,9 @@ unless ENV["EXERCISM_SKIP_S3"]
|
|
19
16
|
Exercism.config.aws_tooling_jobs_bucket,
|
20
17
|
].each do |bucket|
|
21
18
|
begin
|
22
|
-
|
19
|
+
Exercism.s3_client.create_bucket(bucket: bucket)
|
20
|
+
rescue Aws::S3::Errors::BucketAlreadyExists
|
21
|
+
# Bucket already exists
|
23
22
|
rescue Seahorse::Client::NetworkingError => e
|
24
23
|
puts "local S3 not up yet..."
|
25
24
|
sleep 2 # slighty retry delaty
|
@@ -36,14 +35,14 @@ end
|
|
36
35
|
Exercism.config.dynamodb_tooling_jobs_table + "-test"
|
37
36
|
].each do |table_name|
|
38
37
|
begin
|
39
|
-
Exercism.
|
38
|
+
Exercism.dynamodb_client.delete_table(
|
40
39
|
table_name: table_name
|
41
40
|
)
|
42
41
|
rescue Aws::DynamoDB::Errors::ResourceNotFoundException
|
43
42
|
end
|
44
43
|
puts "[x] #{table_name}"
|
45
44
|
|
46
|
-
Exercism.
|
45
|
+
Exercism.dynamodb_client.create_table(
|
47
46
|
table_name: table_name,
|
48
47
|
attribute_definitions: [
|
49
48
|
{
|
@@ -63,7 +62,7 @@ end
|
|
63
62
|
}
|
64
63
|
)
|
65
64
|
|
66
|
-
Exercism.
|
65
|
+
Exercism.dynamodb_client.update_table(
|
67
66
|
table_name: table_name,
|
68
67
|
attribute_definitions: [
|
69
68
|
{
|
@@ -101,7 +100,7 @@ end
|
|
101
100
|
]
|
102
101
|
)
|
103
102
|
|
104
|
-
Exercism.
|
103
|
+
Exercism.dynamodb_client.update_table(
|
105
104
|
table_name: table_name,
|
106
105
|
attribute_definitions: [
|
107
106
|
{
|
@@ -149,14 +148,14 @@ end
|
|
149
148
|
Exercism.config.dynamodb_tooling_language_groups_table + "-test"
|
150
149
|
].each do |table_name|
|
151
150
|
begin
|
152
|
-
Exercism.
|
151
|
+
Exercism.dynamodb_client.delete_table(
|
153
152
|
table_name: table_name
|
154
153
|
)
|
155
154
|
rescue Aws::DynamoDB::Errors::ResourceNotFoundException
|
156
155
|
end
|
157
156
|
puts "[x] #{table_name}"
|
158
157
|
|
159
|
-
Exercism.
|
158
|
+
Exercism.dynamodb_client.create_table(
|
160
159
|
table_name: table_name,
|
161
160
|
attribute_definitions: [
|
162
161
|
{
|
data/exercism_config.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
|
9
9
|
spec.summary = 'Retrieves stored config for Exercism'
|
10
10
|
spec.homepage = 'https://exercism.io'
|
11
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
11
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.6')
|
12
12
|
|
13
13
|
spec.metadata['homepage_uri'] = spec.homepage
|
14
14
|
spec.metadata['source_code_uri'] = 'https://github.com/exercism/config'
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
|
28
28
|
spec.add_dependency 'aws-sdk-dynamodb', '~> 1.0'
|
29
|
+
spec.add_dependency 'aws-sdk-secretsmanager', '~> 1.0'
|
29
30
|
spec.add_dependency 'mandate'
|
30
31
|
spec.add_dependency 'zeitwerk'
|
31
32
|
|
@@ -36,6 +37,7 @@ Gem::Specification.new do |spec|
|
|
36
37
|
|
37
38
|
# This isn't a compulsary dependency
|
38
39
|
# but can be used if someone puts it in their
|
39
|
-
# own
|
40
|
+
# own Gemfile when using this.
|
40
41
|
spec.add_development_dependency 'aws-sdk-s3'
|
42
|
+
spec.add_development_dependency 'aws-sdk-ecr'
|
41
43
|
end
|
data/lib/exercism-config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'aws-sdk-dynamodb'
|
2
|
+
require 'aws-sdk-secretsmanager'
|
2
3
|
require 'mandate'
|
3
4
|
require 'ostruct'
|
4
5
|
require 'json'
|
@@ -9,10 +10,12 @@ require_relative 'exercism_config/generate_aws_settings'
|
|
9
10
|
require_relative 'exercism_config/setup_dynamodb_client'
|
10
11
|
require_relative 'exercism_config/setup_ecr_client'
|
11
12
|
require_relative 'exercism_config/setup_s3_client'
|
12
|
-
require_relative 'exercism_config/
|
13
|
-
require_relative 'exercism_config/
|
13
|
+
require_relative 'exercism_config/retrieve_config'
|
14
|
+
require_relative 'exercism_config/retrieve_secrets'
|
14
15
|
|
16
|
+
require_relative 'exercism_config/version'
|
15
17
|
require_relative 'exercism/config'
|
18
|
+
require_relative 'exercism/secrets'
|
16
19
|
|
17
20
|
module Exercism
|
18
21
|
class ConfigError < RuntimeError; end
|
@@ -21,12 +24,29 @@ module Exercism
|
|
21
24
|
@env ||= ExercismConfig::DetermineEnvironment.()
|
22
25
|
end
|
23
26
|
|
24
|
-
def self.
|
25
|
-
|
26
|
-
env
|
27
|
+
def self.config
|
28
|
+
@config ||= ExercismConfig::RetrieveConfig.()
|
27
29
|
end
|
28
30
|
|
29
|
-
def self.
|
30
|
-
@
|
31
|
+
def self.secrets
|
32
|
+
@secrets ||= ExercismConfig::RetrieveSecrets.()
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.dynamodb_client
|
36
|
+
Aws::DynamoDB::Client.new(ExercismConfig::GenerateAwsSettings.())
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.s3_client
|
40
|
+
require 'aws-sdk-s3'
|
41
|
+
Aws::S3::Client.new(
|
42
|
+
ExercismConfig::GenerateAwsSettings.().merge(
|
43
|
+
force_path_style: true
|
44
|
+
)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.ecr_client
|
49
|
+
require 'aws-sdk-ecr'
|
50
|
+
Aws::ECR::Client.new(ExercismConfig::GenerateAwsSettings.())
|
31
51
|
end
|
32
52
|
end
|
@@ -4,9 +4,7 @@ module ExercismConfig
|
|
4
4
|
|
5
5
|
def call
|
6
6
|
env = ENV['EXERCISM_ENV'] || ENV['RAILS_ENV'] || ENV['APP_ENV']
|
7
|
-
|
8
|
-
env = Rails.env.to_s if Object.const_defined?(:Rails) && Rails.respond_to?(:env)
|
9
|
-
end
|
7
|
+
env = Rails.env.to_s if !env && Object.const_defined?(:Rails) && Rails.respond_to?(:env)
|
10
8
|
|
11
9
|
raise Exercism::ConfigError, 'No environment set - set one of EXERCISM_ENV, RAILS_ENV or APP_ENV' unless env
|
12
10
|
|
@@ -5,7 +5,7 @@ module ExercismConfig
|
|
5
5
|
def call
|
6
6
|
{
|
7
7
|
region: 'eu-west-2',
|
8
|
-
|
8
|
+
endpoint: endpoint,
|
9
9
|
access_key_id: aws_access_key_id,
|
10
10
|
secret_access_key: aws_secret_access_key
|
11
11
|
}.select { |_k, v| v }
|
@@ -22,8 +22,12 @@ module ExercismConfig
|
|
22
22
|
end
|
23
23
|
|
24
24
|
memoize
|
25
|
-
def
|
26
|
-
Exercism.env.production?
|
25
|
+
def endpoint
|
26
|
+
return nil if Exercism.env.production?
|
27
|
+
return "http://127.0.0.1:#{ENV['AWS_PORT']}" if Exercism.env.test? && ENV['EXERCISM_CI']
|
28
|
+
|
29
|
+
host = ENV['EXERCISM_DOCKER'] ? 'aws:3040' : 'localhost:3040'
|
30
|
+
"http://#{host}"
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ExercismConfig
|
2
|
-
class
|
2
|
+
class RetrieveConfig
|
3
3
|
include Mandate
|
4
4
|
|
5
5
|
def call
|
@@ -13,24 +13,14 @@ module ExercismConfig
|
|
13
13
|
require 'erb'
|
14
14
|
require 'yaml'
|
15
15
|
|
16
|
-
|
17
|
-
'ci'
|
18
|
-
elsif ENV["EXERCISM_DOCKER"]
|
19
|
-
'docker'
|
20
|
-
else
|
21
|
-
'local'
|
22
|
-
end
|
23
|
-
|
24
|
-
settings_file = File.expand_path("../../../settings/#{filename}.yml", __FILE__)
|
16
|
+
settings_file = File.expand_path("../../../settings/#{settings_filename}.yml", __FILE__)
|
25
17
|
settings = YAML.safe_load(ERB.new(File.read(settings_file)).result)
|
26
18
|
|
27
19
|
Exercism::Config.new(settings, {})
|
28
20
|
end
|
29
21
|
|
30
22
|
def retrieve_from_dynamodb
|
31
|
-
|
32
|
-
|
33
|
-
resp = client.scan({ table_name: 'config' })
|
23
|
+
resp = Exercism.dynamodb_client.scan({ table_name: 'config' })
|
34
24
|
items = resp.to_h[:items]
|
35
25
|
data = items.each_with_object({}) do |item, h|
|
36
26
|
h[item['id']] = item['value']
|
@@ -44,17 +34,15 @@ module ExercismConfig
|
|
44
34
|
raise Exercism::ConfigError, "Exercism Config could not be loaded: #{e.message}"
|
45
35
|
end
|
46
36
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}.select { |_k, v| v }
|
56
|
-
|
57
|
-
Aws::DynamoDB::Client.new(config)
|
37
|
+
def settings_filename
|
38
|
+
if ENV["EXERCISM_CI"]
|
39
|
+
'ci'
|
40
|
+
elsif ENV["EXERCISM_DOCKER"]
|
41
|
+
'docker'
|
42
|
+
else
|
43
|
+
'local'
|
44
|
+
end
|
58
45
|
end
|
46
|
+
|
59
47
|
end
|
60
48
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module ExercismConfig
|
2
|
+
class RetrieveSecrets
|
3
|
+
include Mandate
|
4
|
+
|
5
|
+
def call
|
6
|
+
return generate_mock if Exercism.env.test?
|
7
|
+
|
8
|
+
retrieve_from_aws
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def generate_mock
|
13
|
+
require 'erb'
|
14
|
+
require 'yaml'
|
15
|
+
|
16
|
+
settings_file = File.expand_path('../../settings/secrets.yml', __dir__)
|
17
|
+
settings = YAML.safe_load(ERB.new(File.read(settings_file)).result)
|
18
|
+
|
19
|
+
Exercism::Settings.new(settings, {})
|
20
|
+
end
|
21
|
+
|
22
|
+
def retrieve_from_aws
|
23
|
+
client = Aws::SecretsManager::Client.new(GenerateAwsSettings.())
|
24
|
+
json = client.get_secret_value(secret_id: "config").secret_string
|
25
|
+
Exercism::Secrets.new(JSON.parse(json))
|
26
|
+
rescue StandardError => e
|
27
|
+
raise Exercism::ConfigError, "Exercism's secrets could not be loaded: #{e.message}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -3,25 +3,9 @@ module ExercismConfig
|
|
3
3
|
include Mandate
|
4
4
|
|
5
5
|
def call
|
6
|
-
|
7
|
-
endpoint: config_endpoint,
|
6
|
+
puts "[DEPRECATION] ExercismConfig::SetupDynamoDBClient.() is deprecated. Please use Exercism.dynamodb_client"
|
8
7
|
|
9
|
-
|
10
|
-
# as we run it locally. But we do normally, so
|
11
|
-
# we locally override this here.
|
12
|
-
profile: nil
|
13
|
-
).select { |_k, v| v }
|
14
|
-
Aws::DynamoDB::Client.new(aws_settings)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
memoize
|
19
|
-
def config_endpoint
|
20
|
-
return nil if Exercism.env.production?
|
21
|
-
return "http://127.0.0.1:#{ENV['DYNAMODB_PORT']}" if Exercism.env.test? && ENV['EXERCISM_CI']
|
22
|
-
|
23
|
-
host = ENV['EXERCISM_DOCKER'] ? 'dynamodb:8000' : 'localhost:3040'
|
24
|
-
"http://#{host}"
|
8
|
+
Exercism.dynamodb_client
|
25
9
|
end
|
26
10
|
end
|
27
11
|
end
|
@@ -3,16 +3,9 @@ module ExercismConfig
|
|
3
3
|
include Mandate
|
4
4
|
|
5
5
|
def call
|
6
|
-
|
7
|
-
# endpoint: config_endpoint,
|
6
|
+
puts "[DEPRECATION] ExercismConfig::SetupECRClient.() is deprecated. Please use Exercism.ecr_client"
|
8
7
|
|
9
|
-
|
10
|
-
# as we run it locally. But we do normally, so
|
11
|
-
# we locally override this here.
|
12
|
-
profile: nil
|
13
|
-
).select { |_k, v| v }
|
14
|
-
|
15
|
-
Aws::ECR::Client.new(aws_settings)
|
8
|
+
Exercism.ecr_client
|
16
9
|
end
|
17
10
|
end
|
18
11
|
end
|
@@ -3,28 +3,9 @@ module ExercismConfig
|
|
3
3
|
include Mandate
|
4
4
|
|
5
5
|
def call
|
6
|
-
|
6
|
+
puts "[DEPRECATION] ExercismConfig::SetupS3Client.() is deprecated. Please use Exercism.s3_client"
|
7
7
|
|
8
|
-
|
9
|
-
endpoint: config_endpoint,
|
10
|
-
force_path_style: true,
|
11
|
-
|
12
|
-
# We don't want a profile for this AWS service
|
13
|
-
# as we run it locally. But we do normally, so
|
14
|
-
# we locally override this here.
|
15
|
-
profile: nil
|
16
|
-
).select { |_k, v| v }
|
17
|
-
Aws::S3::Client.new(aws_settings)
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
memoize
|
22
|
-
def config_endpoint
|
23
|
-
return nil if Exercism.env.production?
|
24
|
-
return "http://127.0.0.1:#{ENV['S3_PORT']}" if Exercism.env.test? && ENV['EXERCISM_CI']
|
25
|
-
|
26
|
-
host = ENV['EXERCISM_DOCKER'] ? 's3:9090' : 'localhost:3041'
|
27
|
-
"http://#{host}"
|
8
|
+
Exercism.s3_client
|
28
9
|
end
|
29
10
|
end
|
30
11
|
end
|
data/settings/ci.yml
CHANGED
@@ -6,7 +6,7 @@ dynamodb_tooling_jobs_table: tooling_jobs
|
|
6
6
|
dynamodb_tooling_language_groups_table: tooling_language_groups
|
7
7
|
spi_url: http://127.0.0.1:3020
|
8
8
|
tooling_orchestrator_url: http://127.0.0.1:3021
|
9
|
-
|
9
|
+
language_server_url: ws://127.0.0.1:3023
|
10
10
|
|
11
11
|
mysql_master_endpoint: 127.0.0.1
|
12
12
|
mysql_port: <%= ENV["MYSQL_PORT"] %>
|
data/settings/docker.yml
CHANGED
data/settings/local.yml
CHANGED
@@ -6,6 +6,6 @@ dynamodb_tooling_jobs_table: tooling_jobs
|
|
6
6
|
dynamodb_tooling_language_groups_table: tooling_language_groups
|
7
7
|
mysql_master_endpoint: localhost
|
8
8
|
mysql_socket: /tmp/mysql.sock
|
9
|
-
spi_url: http://
|
10
|
-
tooling_orchestrator_url: http://
|
11
|
-
|
9
|
+
spi_url: http://localhost:3020
|
10
|
+
tooling_orchestrator_url: http://localhost:3021
|
11
|
+
language_server_url: ws://localhost:3023
|
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.53.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-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-sdk-secretsmanager
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: mandate
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,20 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: aws-sdk-ecr
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
description:
|
126
154
|
email:
|
127
155
|
- jez.walker@gmail.com
|
@@ -148,10 +176,12 @@ files:
|
|
148
176
|
- exercism_config.gemspec
|
149
177
|
- lib/exercism-config.rb
|
150
178
|
- lib/exercism/config.rb
|
179
|
+
- lib/exercism/secrets.rb
|
151
180
|
- lib/exercism_config/determine_environment.rb
|
152
181
|
- lib/exercism_config/environment.rb
|
153
182
|
- lib/exercism_config/generate_aws_settings.rb
|
154
|
-
- lib/exercism_config/
|
183
|
+
- lib/exercism_config/retrieve_config.rb
|
184
|
+
- lib/exercism_config/retrieve_secrets.rb
|
155
185
|
- lib/exercism_config/setup_dynamodb_client.rb
|
156
186
|
- lib/exercism_config/setup_ecr_client.rb
|
157
187
|
- lib/exercism_config/setup_s3_client.rb
|
@@ -160,6 +190,7 @@ files:
|
|
160
190
|
- settings/ci.yml
|
161
191
|
- settings/docker.yml
|
162
192
|
- settings/local.yml
|
193
|
+
- settings/secrets.yml
|
163
194
|
- yarn.lock
|
164
195
|
homepage: https://exercism.io
|
165
196
|
licenses: []
|
@@ -174,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
205
|
requirements:
|
175
206
|
- - ">="
|
176
207
|
- !ruby/object:Gem::Version
|
177
|
-
version: 2.
|
208
|
+
version: 2.6.6
|
178
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
210
|
requirements:
|
180
211
|
- - ">="
|