Module: Exercism
- Defined in:
- lib/exercism.rb,
lib/exercism/config.rb,
lib/exercism/secrets.rb,
lib/exercism/tooling_job.rb
Defined Under Namespace
Classes: Config, ConfigError, Secrets, ToolingJob
Class Method Summary
collapse
Class Method Details
.cloudwatch_logs_client ⇒ Object
38
39
40
41
|
# File 'lib/exercism.rb', line 38
def self.cloudwatch_logs_client
require 'aws-sdk-cloudwatchlogs'
Aws::CloudWatchLogs::Client.new(ExercismConfig::GenerateAwsSettings.())
end
|
.discourse_client ⇒ Object
86
87
88
89
90
91
92
93
|
# File 'lib/exercism.rb', line 86
def self.discourse_client
require 'discourse_api'
DiscourseApi::Client.new("https://forum.exercism.org").tap do |client|
client.api_key = ENV.fetch("DISCOURSE_API_KEY", Exercism.secrets.discourse_api_key)
client.api_username = ENV.fetch("DISCOURSE_API_USERNAME", "system")
end
end
|
.dynamodb_client ⇒ Object
.mongodb_client ⇒ Object
95
96
97
98
99
100
101
|
# File 'lib/exercism.rb', line 95
def self.mongodb_client
require 'mongo'
Mongo::Client.new(
self.config.mongodb_url,
database: self.config.mongodb_database_name
)
end
|
.octokit_client ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/exercism.rb', line 44
def self.octokit_client
require 'octokit'
access_token = ENV.fetch(
"GITHUB_ACCESS_TOKEN",
self.secrets.github_access_token
)
@octokit_client ||= Octokit::Client.new(
access_token:
).tap do |c|
c.auto_paginate = true
end
end
|
.octokit_graphql_client ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/exercism.rb', line 59
def self.octokit_graphql_client
require 'octokit'
@octokit_graphql_client ||= Octokit::Client.new(
access_token: self.secrets.github_graphql_readonly_access_token
).tap do |c|
c.auto_paginate = true
end
end
|
.opensearch_client ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/exercism.rb', line 69
def self.opensearch_client
require 'elasticsearch'
Elasticsearch::Client.new(
url: ENV.fetch("OPENSEARCH_HOST", config.opensearch_host),
user: ENV.fetch("OPENSEARCH_USER", Exercism.env.production? ? nil : "admin"),
password: ENV.fetch("OPENSEARCH_PASSWORD", Exercism.env.production? ? nil : "admin"),
transport_options: {
ssl: {
verify: Exercism.env.production?
}
}
)
end
|
16
17
18
|
# File 'lib/exercism.rb', line 16
def self.redis_tooling_client
Redis.new(url: config.tooling_redis_url)
end
|
.s3_client ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/exercism.rb', line 24
def self.s3_client
require 'aws-sdk-s3'
Aws::S3::Client.new(
ExercismConfig::GenerateAwsSettings.().merge(
force_path_style: true
)
)
end
|