-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simpify config lookups with helper class which checks ENV first, then (…
…#44) check ENV then astral.yml for configuration key
- Loading branch information
Showing
11 changed files
with
53 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
class AuditLogger < ActiveSupport::Logger | ||
def initialize | ||
super(Rails.configuration.astral[:audit_log_file]) | ||
super(Config[:audit_log_file]) | ||
self.formatter = AuditLogFormatter.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Config | ||
class << self | ||
def get(key) | ||
ENV[key.to_s.upcase] || Rails.configuration.astral[key.to_s.downcase.to_sym] | ||
end | ||
|
||
def set(key, value) | ||
ENV[key.to_s.upcase] = value | ||
end | ||
|
||
def [](key) | ||
get(key) | ||
end | ||
|
||
def []=(key, value) | ||
set(key, value) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
shared: | ||
vault_addr: <%= ENV["VAULT_ADDR"] %> | ||
vault_token: <%= ENV["VAULT_TOKEN"] %> | ||
vault_addr: | ||
vault_token: | ||
|
||
# Pre-existing root CA, or create new if requested | ||
vault_create_root: <%= ENV["VAULT_CREATE_ROOT"] || "true" %> | ||
vault_root_ca_ref: <%= ENV["VAULT_ROOT_CA_REF"] || "root-ca" %> | ||
vault_root_ca_mount: <%= ENV["VAULT_ROOT_CA_MOUNT"] || "pki_root" %> | ||
vault_create_root: true | ||
vault_root_ca_ref: root_ca | ||
vault_root_ca_mount: pki_root | ||
|
||
jwt_signing_key: <%= ENV["JWT_SIGNING_KEY"] %> | ||
cert_ttl: <%= ENV["CERT_TTL"] %> | ||
jwt_signing_key: | ||
cert_ttl: | ||
|
||
app_registry_addr: <%= ENV["APP_REGISTRY_ADDR"] %> | ||
app_registry_token: <%= ENV["APP_REGISTRY_TOKEN"] %> | ||
app_registry_ca_file: <%= ENV["APP_REGISTRY_CA_FILE"] %> | ||
app_registry_client_cert: <%= ENV["APP_REGISTRY_CLIENT_CERT"] %> | ||
app_registry_client_key: <%= ENV["APP_REGISTRY_CLIENT_KEY"] %> | ||
app_registry_addr: | ||
app_registry_token: | ||
app_registry_ca_file: | ||
app_registry_client_cert: | ||
app_registry_client_key: | ||
|
||
audit_log_file: <%= ENV["AUDIT_LOG_FILE"] || "#{Rails.root.join('log')}/astral-audit.log" %> | ||
audit_log_file: <%= "#{Rails.root.join('log')}/astral-audit.log" %> | ||
|
||
test: | ||
cert_ttl: <%= 24.hours.in_seconds %> | ||
|
||
development: | ||
|
||
production: | ||
vault_create_root: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters