Class: DaggerRuby::Config
- Inherits:
-
Object
- Object
- DaggerRuby::Config
- Defined in:
- lib/dagger_ruby/config.rb
Constant Summary collapse
- ENGINE_IMAGE =
"registry.dagger.io/engine".freeze
- RUNTIMES =
%i[auto apple docker].freeze
Instance Attribute Summary collapse
-
#dagger_version ⇒ Object
readonly
Returns the value of attribute dagger_version.
-
#log_output ⇒ Object
readonly
Returns the value of attribute log_output.
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
-
#quiet ⇒ Object
readonly
Returns the value of attribute quiet.
-
#runner_host ⇒ Object
readonly
Returns the value of attribute runner_host.
-
#runtime ⇒ Object
readonly
Returns the value of attribute runtime.
-
#silent ⇒ Object
readonly
Returns the value of attribute silent.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#verify_version ⇒ Object
readonly
Returns the value of attribute verify_version.
-
#workdir ⇒ Object
readonly
Returns the value of attribute workdir.
Instance Method Summary collapse
- #environment ⇒ Object
- #expected_engine_version ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dagger_ruby/config.rb', line 12 def initialize( = {}) @log_output = [:log_output] @workdir = [:workdir] @timeout = [:timeout] || 600 @quiet = [:quiet] || ENV["DAGGER_QUIET"]&.to_i @silent = [:silent] || ENV["DAGGER_SILENT"] == "true" @progress = [:progress] || ENV.fetch("DAGGER_PROGRESS", nil) @runtime = normalize_runtime(.fetch(:runtime, ENV.fetch("DAGGER_RUBY_RUNTIME", "auto"))) @runner_host = [:runner_host] @dagger_version = .fetch(:dagger_version, DAGGER_VERSION).to_s.delete_prefix("v") @verify_version = .fetch(:verify_version, true) raise ArgumentError, "runner_host and runtime cannot both be configured" if @runner_host && @runtime != :auto end |
Instance Attribute Details
#dagger_version ⇒ Object (readonly)
Returns the value of attribute dagger_version.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def dagger_version @dagger_version end |
#log_output ⇒ Object (readonly)
Returns the value of attribute log_output.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def log_output @log_output end |
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def progress @progress end |
#quiet ⇒ Object (readonly)
Returns the value of attribute quiet.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def quiet @quiet end |
#runner_host ⇒ Object (readonly)
Returns the value of attribute runner_host.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def runner_host @runner_host end |
#runtime ⇒ Object (readonly)
Returns the value of attribute runtime.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def runtime @runtime end |
#silent ⇒ Object (readonly)
Returns the value of attribute silent.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def silent @silent end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def timeout @timeout end |
#verify_version ⇒ Object (readonly)
Returns the value of attribute verify_version.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def verify_version @verify_version end |
#workdir ⇒ Object (readonly)
Returns the value of attribute workdir.
9 10 11 |
# File 'lib/dagger_ruby/config.rb', line 9 def workdir @workdir end |
Instance Method Details
#environment ⇒ Object
27 28 29 30 31 |
# File 'lib/dagger_ruby/config.rb', line 27 def environment environment = {} environment["_EXPERIMENTAL_DAGGER_RUNNER_HOST"] = resolved_runner_host if resolved_runner_host environment end |
#expected_engine_version ⇒ Object
33 34 35 |
# File 'lib/dagger_ruby/config.rb', line 33 def expected_engine_version "v#{dagger_version}" end |