exercism-config 0.89.0 → 0.91.0

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: 1710d2fd75778b017a29df02e7c236d320ec6e562e221f7b6c4723ec908d8321
4
- data.tar.gz: 5f61e24f861feb0ee626cab1161aedb723b55f7cc3bcdd865047e665096bee7f
3
+ metadata.gz: 9d253cd963bd2cd1762d7672d3deefb8f8e85a716e1bf70e8339d2b730842381
4
+ data.tar.gz: c788cd77a39a0beba4ea63841b284856681d2b89d69ca23cdd9fa3c5f9131727
5
5
  SHA512:
6
- metadata.gz: 6f95cf47fcc16941a290bd1aa5b8a523184be88ab0471479e44db8db8aac4db79e973a6d0aafa0d6fa854486163da93d719e78fe1a61da12d71914d24f6d62e6
7
- data.tar.gz: 8e81ae560fdca7919a17c98a2d243861a1445c4d6a44d35d348909ab77b7e5556770167598f53d2a75e2425902e6eef22c7bf95388c2efcb34d16aefd084cca6
6
+ metadata.gz: f44aae054b096604b1746ab4733da45e9697d004f3f4ca788d8ff404f1f8524fb4691e9f41882ca875b510413c9940d0e3d9af7abc8986f9dd021e5e07f4dfc2
7
+ data.tar.gz: eace4c0f2bf8cd2007ea618e38bc9a41d8b5b3de90042eae70392385b8e6106fee2a269b73ea1d792e4607424a295aa092cc376a4a5fbabb9857d9454574f16d
@@ -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 Exercism
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
@@ -1,3 +1,3 @@
1
1
  module ExercismConfig
2
- VERSION = '0.89.0'.freeze
2
+ VERSION = '0.91.0'.freeze
3
3
  end
data/settings/local.yml CHANGED
@@ -6,7 +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
+ chatgpt_proxy_url: http://local.exercism.io:3026/ask_chatgpt
10
10
 
11
11
  # DynamoDB config
12
12
  dynamodb_tooling_jobs_table: tooling_jobs
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.89.0
4
+ version: 0.91.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: 2023-04-23 00:00:00.000000000 Z
11
+ date: 2023-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb
@@ -222,6 +222,7 @@ files:
222
222
  - bin/setup_exercism_local_aws
223
223
  - exercism_config.gemspec
224
224
  - lib/exercism-config.rb
225
+ - lib/exercism.rb
225
226
  - lib/exercism/config.rb
226
227
  - lib/exercism/secrets.rb
227
228
  - lib/exercism/tooling_job.rb