Class: Microservice::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/microservice/settings.rb

Class Method Summary collapse

Class Method Details

.allObject



6
7
8
# File 'lib/microservice/settings.rb', line 6

def all
  Rails.application.secrets
end

.application_nameObject



10
11
12
# File 'lib/microservice/settings.rb', line 10

def application_name
  all[:application_name] || 'Microservice Application'
end

.email_default_fromObject



14
15
16
# File 'lib/microservice/settings.rb', line 14

def email_default_from
  all[:email_default_from]
end

.hostObject



26
27
28
# File 'lib/microservice/settings.rb', line 26

def host
  "#{protocol}://#{host_name}"
end

.host_nameObject



18
19
20
# File 'lib/microservice/settings.rb', line 18

def host_name
  all[:host_name] || 'localhost'
end

.omniauth_provider_path(provider) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/microservice/settings.rb', line 42

def omniauth_provider_path(provider)
  if opts = omniauth_providers[provider]
    url = "/users/auth/#{provider}"

    x = []
    x << "auth_provider=#{opts[:auth_provider]}" if opts[:auth_provider]
    x << "auth_url=#{opts[:auth_url]}" if opts[:auth_url]

    if x.present?
      url += '?' + x.join('&')
    end

    url
  else
    ''
  end
end

.omniauth_providersObject



34
35
36
# File 'lib/microservice/settings.rb', line 34

def omniauth_providers
  all[:omniauth_providers] || {}
end

.omniauth_providers_keysObject



38
39
40
# File 'lib/microservice/settings.rb', line 38

def omniauth_providers_keys
  omniauth_providers.keys
end

.protocolObject



22
23
24
# File 'lib/microservice/settings.rb', line 22

def protocol
  all[:protocol] || 'http'
end

.uuid_prefixObject



30
31
32
# File 'lib/microservice/settings.rb', line 30

def uuid_prefix
  all[:uuid_prefix] || 'micro'
end