Class: VagrantDockerCertificatesManager::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-docker-certificates-manager/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 9

def initialize
  @cert_path            = "certs/rootca.cert.pem"
  @cert_name            = "local.dev"
  @install_on_up        = false
  @remove_on_destroy    = false
  @manage_firefox       = false
  @manage_nss_browsers  = true
  @locale               = "en"
  @verbose              = false
  @container_name       = nil
end

Instance Attribute Details

#cert_nameObject

Returns the value of attribute cert_name.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def cert_name
  @cert_name
end

#cert_pathObject

Returns the value of attribute cert_path.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def cert_path
  @cert_path
end

#container_nameObject

Returns the value of attribute container_name.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def container_name
  @container_name
end

#install_on_upObject

Returns the value of attribute install_on_up.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def install_on_up
  @install_on_up
end

#localeObject

Returns the value of attribute locale.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def locale
  @locale
end

#manage_firefoxObject

Returns the value of attribute manage_firefox.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def manage_firefox
  @manage_firefox
end

#manage_nss_browsersObject

Returns the value of attribute manage_nss_browsers.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def manage_nss_browsers
  @manage_nss_browsers
end

#remove_on_destroyObject

Returns the value of attribute remove_on_destroy.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def remove_on_destroy
  @remove_on_destroy
end

#verboseObject

Returns the value of attribute verbose.



5
6
7
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 5

def verbose
  @verbose
end

Instance Method Details

#finalize!Object



21
22
23
24
25
26
27
28
29
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 21

def finalize!
  @cert_path = @container_name unless @container_name.to_s.strip.empty?
  @install_on_up       = !!@install_on_up
  @remove_on_destroy   = !!@remove_on_destroy
  @manage_firefox      = !!@manage_firefox
  @manage_nss_browsers = !!@manage_nss_browsers
  @verbose             = !!@verbose
  @locale              = (@locale || "en").to_s
end

#validate(_machine) ⇒ Object



31
32
33
34
35
36
# File 'lib/vagrant-docker-certificates-manager/config.rb', line 31

def validate(_machine)
  errors = []
  errors << "cert_path must be provided" if @cert_path.to_s.strip.empty?
  errors << "cert_name must be provided" if @cert_name.to_s.strip.empty?
  { "vagrant-docker-certificates-manager" => errors }
end