Class: AuroraDataApi::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/aurora-data-api/environment.rb

Class Method Summary collapse

Class Method Details

.database_nameObject



17
18
19
# File 'lib/aurora-data-api/environment.rb', line 17

def self.database_name
  ENV["PGDATABASE"] || ENV["MYSQL_DATABASE"]
end

.offline?Boolean

Resources about “OFFLINE”:

https://www.serverless.com/plugins/serverless-offline
https://github.com/koxudaxi/local-data-api

Returns:

  • (Boolean)


9
10
11
# File 'lib/aurora-data-api/environment.rb', line 9

def self.offline?
  ENV["IS_OFFLINE"] == "true"
end

.offline_endpointObject



13
14
15
# File 'lib/aurora-data-api/environment.rb', line 13

def self.offline_endpoint
  "http://local-data-api"
end

.regionObject



21
22
23
# File 'lib/aurora-data-api/environment.rb', line 21

def self.region
  ENV.fetch("AWS_DEFAULT_REGION", "ap-northeast-1")
end

.resource_arnObject



33
34
35
36
37
38
39
# File 'lib/aurora-data-api/environment.rb', line 33

def self.resource_arn
  if offline?
    "arn:aws:rds:us-east-1:123456789012:cluster:dummy"
  else
    ENV["RDS_RESOURCE_ARN"]
  end
end

.secret_arnObject



25
26
27
28
29
30
31
# File 'lib/aurora-data-api/environment.rb', line 25

def self.secret_arn
  if offline?
    "arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy"
  else
    ENV["RDS_SECRET_ARN"]
  end
end