exercism-config 0.88.0 → 0.90.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/pause-community-contributions.yml +22 -0
- data/.gitignore +2 -0
- data/.ruby-version +1 -1
- data/lib/exercism-config.rb +21 -91
- data/lib/exercism.rb +78 -0
- data/lib/exercism_config/retrieve_secrets.rb +7 -1
- data/lib/exercism_config/version.rb +1 -1
- data/settings/local.yml +1 -0
- data/settings/secrets.yml +5 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a56fb8af776fc23021dcb23360d67d53224e7183e3354e510e77b42f17fc814
|
4
|
+
data.tar.gz: f1a66c11bd44e7d8b75166528720d51c340141215ad918281d60abf629807e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfe55ad103db946afa7f4f2abbecc9234360d07f3d236488cc04966cc7ee1bcd42ad1f21a185dfb39f7ea726900c91294a07c8544f5377c352f05394dc1c2fc8
|
7
|
+
data.tar.gz: 33efc5785923f16b0b30a10c120e594e205c5bc3eae633b36d0981565ce7e4a38d5435ce078b72f2a1e5601853b1f173057769eadd229cf51e9224124fedc9bf
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Pause Community Contributions
|
2
|
+
|
3
|
+
on:
|
4
|
+
issues:
|
5
|
+
types:
|
6
|
+
- opened
|
7
|
+
pull_request_target:
|
8
|
+
types:
|
9
|
+
- opened
|
10
|
+
|
11
|
+
permissions:
|
12
|
+
issues: write
|
13
|
+
pull-requests: write
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
pause:
|
17
|
+
if: github.repository_owner == 'exercism' # Stops this job from running on forks
|
18
|
+
uses: exercism/github-actions/.github/workflows/community-contributions.yml@main
|
19
|
+
with:
|
20
|
+
forum_category: support
|
21
|
+
secrets:
|
22
|
+
github_membership_token: ${{ secrets.COMMUNITY_CONTRIBUTIONS_WORKFLOW_TOKEN }}
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-3.
|
1
|
+
ruby-3.2.1
|
data/lib/exercism-config.rb
CHANGED
@@ -1,98 +1,28 @@
|
|
1
|
+
require "zeitwerk"
|
2
|
+
loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
|
3
|
+
loader.inflector.inflect("exercism-config" => "ExercismConfig")
|
4
|
+
loader.inflector.inflect("version" => "VERSION")
|
5
|
+
loader.setup
|
6
|
+
|
1
7
|
require 'aws-sdk-dynamodb'
|
2
8
|
require 'aws-sdk-secretsmanager'
|
3
9
|
require 'mandate'
|
4
10
|
require 'ostruct'
|
5
11
|
require 'json'
|
6
12
|
|
7
|
-
require_relative 'exercism_config/environment'
|
8
|
-
require_relative 'exercism_config/determine_environment'
|
9
|
-
require_relative 'exercism_config/generate_aws_settings'
|
10
|
-
require_relative 'exercism_config/setup_dynamodb_client'
|
11
|
-
require_relative 'exercism_config/setup_ecr_client'
|
12
|
-
require_relative 'exercism_config/setup_s3_client'
|
13
|
-
require_relative 'exercism_config/retrieve_config'
|
14
|
-
require_relative 'exercism_config/retrieve_secrets'
|
15
|
-
|
16
|
-
require_relative 'exercism_config/version'
|
17
|
-
require_relative 'exercism/config'
|
18
|
-
require_relative 'exercism/secrets'
|
19
|
-
require_relative 'exercism/tooling_job'
|
20
|
-
|
21
|
-
module
|
22
|
-
class ConfigError < RuntimeError; end
|
23
|
-
|
24
|
-
def self.env
|
25
|
-
@env ||= ExercismConfig::DetermineEnvironment.()
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.config
|
29
|
-
@config ||= ExercismConfig::RetrieveConfig.()
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.secrets
|
33
|
-
@secrets ||= ExercismConfig::RetrieveSecrets.()
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.redis_tooling_client
|
37
|
-
Redis.new(url: config.tooling_redis_url)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.dynamodb_client
|
41
|
-
Aws::DynamoDB::Client.new(ExercismConfig::GenerateAwsSettings.())
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.s3_client
|
45
|
-
require 'aws-sdk-s3'
|
46
|
-
Aws::S3::Client.new(
|
47
|
-
ExercismConfig::GenerateAwsSettings.().merge(
|
48
|
-
force_path_style: true
|
49
|
-
)
|
50
|
-
)
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.ecr_client
|
54
|
-
require 'aws-sdk-ecr'
|
55
|
-
Aws::ECR::Client.new(ExercismConfig::GenerateAwsSettings.())
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.octokit_client
|
59
|
-
require 'octokit'
|
60
|
-
|
61
|
-
access_token = ENV.fetch(
|
62
|
-
"GITHUB_ACCESS_TOKEN",
|
63
|
-
self.secrets.github_access_token
|
64
|
-
)
|
65
|
-
|
66
|
-
@octokit_client ||= Octokit::Client.new(
|
67
|
-
access_token: access_token
|
68
|
-
).tap do |c|
|
69
|
-
c.auto_paginate = true
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.opensearch_client
|
74
|
-
require 'elasticsearch'
|
75
|
-
|
76
|
-
# For now, we're using the ElasticSearch client, but this needs to be
|
77
|
-
# changed to the OpenSearch client once it becomes available
|
78
|
-
Elasticsearch::Client.new(
|
79
|
-
url: ENV.fetch("OPENSEARCH_HOST", config.opensearch_host),
|
80
|
-
user: ENV.fetch("OPENSEARCH_USER", Exercism.env.production? ? nil : "admin"),
|
81
|
-
password: ENV.fetch("OPENSEARCH_PASSWORD", Exercism.env.production? ? nil : "admin"),
|
82
|
-
transport_options: {
|
83
|
-
ssl: {
|
84
|
-
verify: Exercism.env.production?
|
85
|
-
}
|
86
|
-
}
|
87
|
-
)
|
88
|
-
end
|
89
|
-
|
90
|
-
def self.discourse_client
|
91
|
-
require 'discourse_api'
|
92
|
-
|
93
|
-
DiscourseApi::Client.new("https://forum.exercism.org").tap do |client|
|
94
|
-
client.api_key = ENV.fetch("DISCOURSE_API_KEY", Exercism.secrets.discourse_api_key)
|
95
|
-
client.api_username = ENV.fetch("DISCOURSE_API_USERNAME", "system")
|
96
|
-
end
|
97
|
-
end
|
13
|
+
# require_relative 'exercism_config/environment'
|
14
|
+
# require_relative 'exercism_config/determine_environment'
|
15
|
+
# require_relative 'exercism_config/generate_aws_settings'
|
16
|
+
# require_relative 'exercism_config/setup_dynamodb_client'
|
17
|
+
# require_relative 'exercism_config/setup_ecr_client'
|
18
|
+
# require_relative 'exercism_config/setup_s3_client'
|
19
|
+
# require_relative 'exercism_config/retrieve_config'
|
20
|
+
# require_relative 'exercism_config/retrieve_secrets'
|
21
|
+
|
22
|
+
# require_relative 'exercism_config/version'
|
23
|
+
# require_relative 'exercism/config'
|
24
|
+
# require_relative 'exercism/secrets'
|
25
|
+
# require_relative 'exercism/tooling_job'
|
26
|
+
#
|
27
|
+
module ::ExercismConfig
|
98
28
|
end
|
data/lib/exercism.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
module Exercism
|
2
|
+
class ConfigError < RuntimeError; end
|
3
|
+
|
4
|
+
def self.env
|
5
|
+
@env ||= ExercismConfig::DetermineEnvironment.()
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.config
|
9
|
+
@config ||= ExercismConfig::RetrieveConfig.()
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.secrets
|
13
|
+
@secrets ||= ExercismConfig::RetrieveSecrets.()
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.redis_tooling_client
|
17
|
+
Redis.new(url: config.tooling_redis_url)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.dynamodb_client
|
21
|
+
Aws::DynamoDB::Client.new(ExercismConfig::GenerateAwsSettings.())
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.s3_client
|
25
|
+
require 'aws-sdk-s3'
|
26
|
+
Aws::S3::Client.new(
|
27
|
+
ExercismConfig::GenerateAwsSettings.().merge(
|
28
|
+
force_path_style: true
|
29
|
+
)
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.ecr_client
|
34
|
+
require 'aws-sdk-ecr'
|
35
|
+
Aws::ECR::Client.new(ExercismConfig::GenerateAwsSettings.())
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.octokit_client
|
39
|
+
require 'octokit'
|
40
|
+
|
41
|
+
access_token = ENV.fetch(
|
42
|
+
"GITHUB_ACCESS_TOKEN",
|
43
|
+
self.secrets.github_access_token
|
44
|
+
)
|
45
|
+
|
46
|
+
@octokit_client ||= Octokit::Client.new(
|
47
|
+
access_token: access_token
|
48
|
+
).tap do |c|
|
49
|
+
c.auto_paginate = true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.opensearch_client
|
54
|
+
require 'elasticsearch'
|
55
|
+
|
56
|
+
# For now, we're using the ElasticSearch client, but this needs to be
|
57
|
+
# changed to the OpenSearch client once it becomes available
|
58
|
+
Elasticsearch::Client.new(
|
59
|
+
url: ENV.fetch("OPENSEARCH_HOST", config.opensearch_host),
|
60
|
+
user: ENV.fetch("OPENSEARCH_USER", Exercism.env.production? ? nil : "admin"),
|
61
|
+
password: ENV.fetch("OPENSEARCH_PASSWORD", Exercism.env.production? ? nil : "admin"),
|
62
|
+
transport_options: {
|
63
|
+
ssl: {
|
64
|
+
verify: Exercism.env.production?
|
65
|
+
}
|
66
|
+
}
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.discourse_client
|
71
|
+
require 'discourse_api'
|
72
|
+
|
73
|
+
DiscourseApi::Client.new("https://forum.exercism.org").tap do |client|
|
74
|
+
client.api_key = ENV.fetch("DISCOURSE_API_KEY", Exercism.secrets.discourse_api_key)
|
75
|
+
client.api_username = ENV.fetch("DISCOURSE_API_USERNAME", "system")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -16,7 +16,13 @@ module ExercismConfig
|
|
16
16
|
secrets_file = File.expand_path('../../settings/secrets.yml', __dir__)
|
17
17
|
secrets = YAML.safe_load(ERB.new(File.read(secrets_file)).result)
|
18
18
|
|
19
|
-
|
19
|
+
personal_secrets_file = "#{Dir.home}/.config/exercism/secrets.yml"
|
20
|
+
if File.exist?(personal_secrets_file)
|
21
|
+
personal_secrets = YAML.safe_load(ERB.new(File.read(personal_secrets_file)).result)
|
22
|
+
Exercism::Secrets.new(secrets.merge(personal_secrets))
|
23
|
+
else
|
24
|
+
Exercism::Secrets.new(secrets)
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
def retrieve_from_aws
|
data/settings/local.yml
CHANGED
@@ -6,6 +6,7 @@ anycable_rpc_host: 127.0.0.1:50051
|
|
6
6
|
tooling_redis_url: redis://127.0.0.1:6379/3
|
7
7
|
snippet_generator_url: http://local.exercism.io:3024/extract_snippet
|
8
8
|
lines_of_code_counter_url: http://local.exercism.io:3025/count_lines_of_code
|
9
|
+
chatgpt_proxy_url: http://local.exercism.io:3026/chatgpt_proxy
|
9
10
|
|
10
11
|
# DynamoDB config
|
11
12
|
dynamodb_tooling_jobs_table: tooling_jobs
|
data/settings/secrets.yml
CHANGED
@@ -15,3 +15,8 @@ discourse_oauth_secret: "some-discourse-oauth-secret"
|
|
15
15
|
discourse_api_key: "some-discourse-api-key"
|
16
16
|
recaptcha_site_key: "some-recaptcha_site_key"
|
17
17
|
recaptcha_secret_key: "some-recaptcha_secret_key"
|
18
|
+
coinbase_webhooks_secret: "some-coinbase-secret"
|
19
|
+
paypal_webhook_id: "some-paypal-webhook-id"
|
20
|
+
paypal_client_id: "some-paypal-client-id"
|
21
|
+
paypal_client_secret: "some-paypal-client-secret"
|
22
|
+
chatgpt_access_token: "some-token"
|
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.90.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -192,7 +192,7 @@ dependencies:
|
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
|
-
description:
|
195
|
+
description:
|
196
196
|
email:
|
197
197
|
- jez.walker@gmail.com
|
198
198
|
executables:
|
@@ -203,6 +203,7 @@ extra_rdoc_files: []
|
|
203
203
|
files:
|
204
204
|
- ".appends/.github/labels.yml"
|
205
205
|
- ".github/labels.yml"
|
206
|
+
- ".github/workflows/pause-community-contributions.yml"
|
206
207
|
- ".github/workflows/rubocop.yml"
|
207
208
|
- ".github/workflows/sync-labels.yml"
|
208
209
|
- ".github/workflows/tests.yml"
|
@@ -221,6 +222,7 @@ files:
|
|
221
222
|
- bin/setup_exercism_local_aws
|
222
223
|
- exercism_config.gemspec
|
223
224
|
- lib/exercism-config.rb
|
225
|
+
- lib/exercism.rb
|
224
226
|
- lib/exercism/config.rb
|
225
227
|
- lib/exercism/secrets.rb
|
226
228
|
- lib/exercism/tooling_job.rb
|
@@ -243,7 +245,7 @@ licenses: []
|
|
243
245
|
metadata:
|
244
246
|
homepage_uri: https://exercism.io
|
245
247
|
source_code_uri: https://github.com/exercism/config
|
246
|
-
post_install_message:
|
248
|
+
post_install_message:
|
247
249
|
rdoc_options: []
|
248
250
|
require_paths:
|
249
251
|
- lib
|
@@ -258,8 +260,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
260
|
- !ruby/object:Gem::Version
|
259
261
|
version: '0'
|
260
262
|
requirements: []
|
261
|
-
rubygems_version: 3.
|
262
|
-
signing_key:
|
263
|
+
rubygems_version: 3.4.6
|
264
|
+
signing_key:
|
263
265
|
specification_version: 4
|
264
266
|
summary: Retrieves stored config for Exercism
|
265
267
|
test_files: []
|