Class: NdrDevSupport::Daemon::CDCredentials
- Inherits:
-
Object
- Object
- NdrDevSupport::Daemon::CDCredentials
- Includes:
- Stoppable
- Defined in:
- lib/ndr_dev_support/daemon/cd_credentials.rb
Overview
Wrapper around Capistrano based Continuous Deployment of application credentials
Assumes there is a capistrano task “app:update_secrets” which can be used together with a target name, e.g. cap target app:update_secrets to update a capistrano target with secrets / credentials from one or more repositories. To use this daemon, a number of environment variables need to be set including CD_TARGETS and CD_URLS.
Constant Summary
Constants included from Stoppable
Stoppable::BIG_SLEEP, Stoppable::LITTLE_SLEEP, Stoppable::MAX_MEMORY, Stoppable::MAX_UPTIME, Stoppable::RESTART_FILENAME
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, cd_targets:, cd_urls:) ⇒ CDCredentials
constructor
A new instance of CDCredentials.
Methods included from Stoppable
#log, #logger, #run, #should_stop?, #stop
Constructor Details
#initialize(name:, cd_targets:, cd_urls:) ⇒ CDCredentials
Returns a new instance of CDCredentials.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ndr_dev_support/daemon/cd_credentials.rb', line 27 def initialize(name:, cd_targets:, cd_urls:) super # Worker name can be used for clear logging: @name = name raise ArgumentError, 'No WORKER_NAME specified!' if name.blank? # Capistrano targets to use for deployments @cd_targets = cd_targets raise ArgumentError, 'No CD_TARGETS specified!' unless cd_targets&.present? # URLs to watch for continuous deployment @cd_urls = cd_urls raise ArgumentError, 'No CD_URLS specified!' unless cd_urls&.present? end |
Class Method Details
.from_args(env) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ndr_dev_support/daemon/cd_credentials.rb', line 19 def self.from_args(env) name = env['WORKER_NAME'].to_s cd_targets = env['CD_TARGETS'].to_s.split cd_urls = env['CD_URLS'].to_s.split new(name: name, cd_targets: cd_targets, cd_urls: cd_urls) end |