dash 3.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/dash +2 -2
- data/lib/{kamal → dash}/cli/accessory.rb +24 -24
- data/lib/dash/cli/alias/command.rb +10 -0
- data/lib/{kamal → dash}/cli/app/assets.rb +2 -2
- data/lib/{kamal → dash}/cli/app/boot.rb +16 -16
- data/lib/{kamal → dash}/cli/app/error_pages.rb +6 -6
- data/lib/{kamal → dash}/cli/app/rollout_boot.rb +6 -6
- data/lib/{kamal → dash}/cli/app/ssl_certificates.rb +3 -3
- data/lib/{kamal → dash}/cli/app.rb +87 -87
- data/lib/{kamal → dash}/cli/base.rb +72 -48
- data/lib/dash/cli/build/clone.rb +59 -0
- data/lib/{kamal → dash}/cli/build/port_forwarding.rb +1 -1
- data/lib/{kamal → dash}/cli/build.rb +45 -45
- data/lib/{kamal → dash}/cli/doctor/config_checks.rb +3 -3
- data/lib/{kamal → dash}/cli/doctor/endpoint_checks.rb +26 -8
- data/lib/{kamal → dash}/cli/doctor/host_checks.rb +22 -22
- data/lib/{kamal → dash}/cli/doctor.rb +9 -9
- data/lib/{kamal → dash}/cli/healthcheck/barrier.rb +2 -2
- data/lib/{kamal → dash}/cli/healthcheck/drift_error.rb +2 -2
- data/lib/dash/cli/healthcheck/error.rb +2 -0
- data/lib/{kamal → dash}/cli/healthcheck/poller.rb +7 -7
- data/lib/{kamal → dash}/cli/lock.rb +1 -1
- data/lib/dash/cli/main/migrate.rb +77 -0
- data/lib/{kamal → dash}/cli/main.rb +82 -71
- data/lib/{kamal → dash}/cli/proxy/drift.rb +3 -3
- data/lib/dash/cli/proxy/legacy_rename.rb +58 -0
- data/lib/{kamal → dash}/cli/proxy/loadbalancer_claim.rb +3 -3
- data/lib/{kamal → dash}/cli/proxy/loadbalancer_reboot.rb +23 -23
- data/lib/{kamal → dash}/cli/proxy/reboot.rb +21 -21
- data/lib/{kamal → dash}/cli/proxy.rb +178 -162
- data/lib/{kamal → dash}/cli/prune.rb +10 -10
- data/lib/{kamal → dash}/cli/registry.rb +11 -11
- data/lib/{kamal → dash}/cli/secrets.rb +3 -3
- data/lib/{kamal → dash}/cli/server.rb +14 -14
- data/lib/{kamal → dash}/cli/templates/deploy.yml +4 -4
- data/lib/dash/cli/templates/sample_hooks/docker-setup.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/post-app-boot.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/post-app-stop.sample +9 -0
- data/lib/dash/cli/templates/sample_hooks/post-deploy.sample +14 -0
- data/lib/dash/cli/templates/sample_hooks/post-proxy-deploy.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/post-proxy-reboot.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/pre-app-boot.sample +3 -0
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-app-stop.sample +2 -2
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-build.sample +8 -8
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-connect.sample +8 -8
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-deploy.sample +9 -9
- data/lib/dash/cli/templates/sample_hooks/pre-proxy-deploy.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/pre-proxy-reboot.sample +3 -0
- data/lib/{kamal → dash}/cli/templates/secrets +6 -6
- data/lib/{kamal → dash}/cli.rb +2 -2
- data/lib/{kamal → dash}/commander/specifics.rb +2 -2
- data/lib/{kamal → dash}/commander.rb +32 -24
- data/lib/{kamal → dash}/commands/accessory/proxy.rb +2 -2
- data/lib/{kamal → dash}/commands/accessory.rb +2 -2
- data/lib/{kamal → dash}/commands/app/assets.rb +1 -1
- data/lib/{kamal → dash}/commands/app/containers.rb +1 -1
- data/lib/{kamal → dash}/commands/app/error_pages.rb +2 -2
- data/lib/{kamal → dash}/commands/app/execution.rb +2 -2
- data/lib/{kamal → dash}/commands/app/images.rb +1 -1
- data/lib/{kamal → dash}/commands/app/logging.rb +1 -1
- data/lib/{kamal → dash}/commands/app/proxy.rb +2 -2
- data/lib/{kamal → dash}/commands/app.rb +2 -2
- data/lib/{kamal → dash}/commands/auditor.rb +3 -7
- data/lib/{kamal → dash}/commands/base.rb +39 -3
- data/lib/{kamal → dash}/commands/builder/base.rb +2 -2
- data/lib/{kamal → dash}/commands/builder/clone.rb +3 -3
- data/lib/{kamal → dash}/commands/builder/cloud.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/hybrid.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/local.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/pack.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/remote.rb +1 -1
- data/lib/{kamal → dash}/commands/builder.rb +7 -7
- data/lib/dash/commands/docker.rb +89 -0
- data/lib/{kamal → dash}/commands/hook.rb +1 -1
- data/lib/{kamal → dash}/commands/loadbalancer.rb +55 -24
- data/lib/{kamal → dash}/commands/lock.rb +3 -3
- data/lib/{kamal → dash}/commands/proxy/cert_transfer.rb +6 -6
- data/lib/dash/commands/proxy.rb +375 -0
- data/lib/{kamal → dash}/commands/prune.rb +2 -2
- data/lib/dash/commands/registry.rb +44 -0
- data/lib/{kamal → dash}/commands/server.rb +1 -5
- data/lib/dash/commands.rb +2 -0
- data/lib/{kamal → dash}/configuration/accessory.rb +13 -13
- data/lib/{kamal → dash}/configuration/alias.rb +3 -3
- data/lib/{kamal → dash}/configuration/boot.rb +2 -2
- data/lib/{kamal → dash}/configuration/builder.rb +7 -7
- data/lib/{kamal → dash}/configuration/docs/accessory.yml +3 -3
- data/lib/{kamal → dash}/configuration/docs/builder.yml +3 -3
- data/lib/{kamal → dash}/configuration/docs/configuration.yml +13 -6
- data/lib/{kamal → dash}/configuration/docs/env.yml +10 -10
- data/lib/{kamal → dash}/configuration/docs/proxy.yml +68 -45
- data/lib/{kamal → dash}/configuration/docs/registry.yml +5 -5
- data/lib/{kamal → dash}/configuration/env/tag.rb +2 -2
- data/lib/{kamal → dash}/configuration/env.rb +5 -5
- data/lib/{kamal → dash}/configuration/loadbalancer.rb +5 -5
- data/lib/{kamal → dash}/configuration/logging.rb +3 -3
- data/lib/{kamal → dash}/configuration/output.rb +4 -4
- data/lib/{kamal → dash}/configuration/proxy/acme.rb +9 -8
- data/lib/{kamal → dash}/configuration/proxy/boot.rb +9 -11
- data/lib/{kamal → dash}/configuration/proxy/run.rb +20 -20
- data/lib/{kamal → dash}/configuration/proxy.rb +51 -29
- data/lib/{kamal → dash}/configuration/registry.rb +3 -3
- data/lib/{kamal → dash}/configuration/role/healthcheck.rb +3 -3
- data/lib/{kamal → dash}/configuration/role.rb +14 -14
- data/lib/{kamal → dash}/configuration/servers.rb +4 -4
- data/lib/{kamal → dash}/configuration/ssh.rb +2 -2
- data/lib/{kamal → dash}/configuration/sshkit.rb +2 -2
- data/lib/{kamal → dash}/configuration/validation.rb +2 -2
- data/lib/{kamal → dash}/configuration/validator/accessory.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator/alias.rb +2 -2
- data/lib/{kamal → dash}/configuration/validator/builder.rb +1 -1
- data/lib/dash/configuration/validator/configuration.rb +6 -0
- data/lib/{kamal → dash}/configuration/validator/env.rb +2 -2
- data/lib/{kamal → dash}/configuration/validator/proxy.rb +31 -31
- data/lib/{kamal → dash}/configuration/validator/registry.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator/role.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator/servers.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator.rb +4 -4
- data/lib/{kamal → dash}/configuration/volume.rb +2 -2
- data/lib/{kamal → dash}/configuration.rb +47 -37
- data/lib/{kamal → dash}/docker.rb +1 -1
- data/lib/{kamal → dash}/env_file.rb +1 -1
- data/lib/{kamal → dash}/git.rb +1 -1
- data/lib/{kamal → dash}/otel_shipper.rb +3 -3
- data/lib/{kamal → dash}/output/base_logger.rb +1 -1
- data/lib/{kamal → dash}/output/file_logger.rb +1 -1
- data/lib/{kamal → dash}/output/formatter.rb +1 -1
- data/lib/{kamal → dash}/output/otel_logger.rb +3 -3
- data/lib/dash/project_directory.rb +28 -0
- data/lib/{kamal → dash}/secrets/adapters/aws_secrets_manager.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/base.rb +2 -2
- data/lib/{kamal → dash}/secrets/adapters/bitwarden.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/bitwarden_secrets_manager.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/doppler.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/enpass.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/gcp_secret_manager.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/last_pass.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/one_password.rb +2 -2
- data/lib/{kamal → dash}/secrets/adapters/passbolt.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/test.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters.rb +2 -2
- data/lib/{kamal → dash}/secrets/dotenv/inline_command_substitution.rb +2 -2
- data/lib/{kamal → dash}/secrets.rb +6 -6
- data/lib/{kamal → dash}/tags.rb +8 -3
- data/lib/{kamal → dash}/utils/sensitive.rb +1 -1
- data/lib/{kamal → dash}/utils.rb +16 -6
- data/lib/dash/version.rb +3 -0
- data/lib/{kamal.rb → dash.rb} +4 -4
- metadata +157 -154
- data/lib/kamal/cli/alias/command.rb +0 -10
- data/lib/kamal/cli/build/clone.rb +0 -59
- data/lib/kamal/cli/healthcheck/error.rb +0 -2
- data/lib/kamal/cli/templates/sample_hooks/docker-setup.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/post-app-boot.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/post-app-stop.sample +0 -9
- data/lib/kamal/cli/templates/sample_hooks/post-deploy.sample +0 -14
- data/lib/kamal/cli/templates/sample_hooks/post-proxy-deploy.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/post-proxy-reboot.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/pre-app-boot.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/pre-proxy-deploy.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/pre-proxy-reboot.sample +0 -3
- data/lib/kamal/commands/docker.rb +0 -55
- data/lib/kamal/commands/proxy.rb +0 -266
- data/lib/kamal/commands/registry.rb +0 -38
- data/lib/kamal/commands.rb +0 -2
- data/lib/kamal/configuration/validator/configuration.rb +0 -6
- data/lib/kamal/version.rb +0 -3
- /data/lib/{kamal → dash}/configuration/docs/alias.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/boot.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/logging.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/output.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/role.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/servers.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/ssh.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/sshkit.yml +0 -0
- /data/lib/{kamal → dash}/sshkit_with_ext.rb +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Output::OtelLogger < Dash::Output::BaseLogger
|
|
2
2
|
def self.build(settings:, config:)
|
|
3
3
|
raise ArgumentError, "OTel endpoint is required" unless settings["endpoint"]
|
|
4
4
|
new(
|
|
5
5
|
endpoint: settings["endpoint"],
|
|
6
|
-
tags:
|
|
6
|
+
tags: Dash::Tags.from_config(config).except(:service_version, :recorded_at),
|
|
7
7
|
service: config.service
|
|
8
8
|
)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def initialize(endpoint:, tags:, service: nil)
|
|
12
12
|
@endpoint = endpoint
|
|
13
|
-
@shipper =
|
|
13
|
+
@shipper = Dash::OtelShipper.new(endpoint: endpoint, tags: tags)
|
|
14
14
|
@service = service
|
|
15
15
|
super()
|
|
16
16
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Where a project keeps its dash-owned files - secrets and hooks - in the
|
|
2
|
+
# operator's own repository. Renamed from `.kamal` in stage 3a of the server
|
|
3
|
+
# artifact rename (zoolutions/dash#118); `.kamal` stays readable until 5.0 so an
|
|
4
|
+
# upgrade doesn't turn every existing project into a missing-secret error.
|
|
5
|
+
#
|
|
6
|
+
# Deliberately not memoized: `dash migrate` moves the directory inside a single
|
|
7
|
+
# process, and a cached answer would be stale for the rest of that invocation.
|
|
8
|
+
class Dash::ProjectDirectory
|
|
9
|
+
CURRENT = ".dash"
|
|
10
|
+
LEGACY = ".kamal"
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def path
|
|
14
|
+
legacy? ? LEGACY : CURRENT
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The predicate tests the directory rather than a specific file: a project
|
|
18
|
+
# holding only `secrets-common` or `secrets.<destination>` must still
|
|
19
|
+
# resolve, and Dash::Secrets synthesizes those names from the base path.
|
|
20
|
+
def legacy?
|
|
21
|
+
!Dir.exist?(CURRENT) && Dir.exist?(LEGACY)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def join(*parts)
|
|
25
|
+
File.join(path, *parts)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
class
|
|
2
|
-
delegate :optionize, to:
|
|
1
|
+
class Dash::Secrets::Adapters::Base
|
|
2
|
+
delegate :optionize, to: Dash::Utils
|
|
3
3
|
|
|
4
4
|
def fetch(secrets, account: nil, from: nil)
|
|
5
5
|
raise RuntimeError, "Missing required option '--account'" if requires_account? && account.blank?
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#
|
|
9
9
|
# Fetch only DB_PASSWORD from FooBar item
|
|
10
10
|
# `dash secrets fetch --adapter enpass --from /Users/YOUR_USERNAME/Library/Containers/in.sinew.Enpass-Desktop/Data/Documents/Vaults/primary FooBar/DB_PASSWORD`
|
|
11
|
-
class
|
|
11
|
+
class Dash::Secrets::Adapters::Enpass < Dash::Secrets::Adapters::Base
|
|
12
12
|
def requires_account?
|
|
13
13
|
false
|
|
14
14
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Secrets::Adapters::GcpSecretManager < Dash::Secrets::Adapters::Base
|
|
2
2
|
private
|
|
3
3
|
def login(account)
|
|
4
4
|
# Since only the account option is passed from the cli, we'll use it for both account and service account
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "active_support/core_ext/string/inflections"
|
|
2
|
-
module
|
|
2
|
+
module Dash::Secrets::Adapters
|
|
3
3
|
def self.lookup(name)
|
|
4
4
|
name = "one_password" if name.downcase == "1password"
|
|
5
5
|
name = "last_pass" if name.downcase == "lastpass"
|
|
@@ -9,7 +9,7 @@ module Kamal::Secrets::Adapters
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def self.adapter_class(name)
|
|
12
|
-
Object.const_get("
|
|
12
|
+
Object.const_get("Dash::Secrets::Adapters::#{name.camelize}").new
|
|
13
13
|
rescue NameError => e
|
|
14
14
|
raise RuntimeError, "Unknown secrets adapter: #{name}"
|
|
15
15
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Secrets::Dotenv::InlineCommandSubstitution
|
|
2
2
|
# Unlike dotenv, this regex does not match escaped
|
|
3
3
|
# parentheses when looking for command substitutions.
|
|
4
4
|
INTERPOLATED_SHELL_COMMAND = /
|
|
@@ -43,7 +43,7 @@ class Kamal::Secrets::Dotenv::InlineCommandSubstitution
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def inline_secrets_command(command)
|
|
46
|
-
|
|
46
|
+
Dash::Cli::Main.start(command.shellsplit[1..] + [ "--inline" ]).chomp
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require "dotenv"
|
|
2
2
|
|
|
3
|
-
class
|
|
4
|
-
|
|
3
|
+
class Dash::Secrets
|
|
4
|
+
Dash::Secrets::Dotenv::InlineCommandSubstitution.install!
|
|
5
5
|
|
|
6
|
-
def initialize(destination: nil, secrets_path:
|
|
6
|
+
def initialize(destination: nil, secrets_path: nil)
|
|
7
7
|
@destination = destination
|
|
8
|
-
@secrets_path = secrets_path
|
|
8
|
+
@secrets_path = secrets_path || Dash::ProjectDirectory.join("secrets")
|
|
9
9
|
@mutex = Mutex.new
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -13,9 +13,9 @@ class Kamal::Secrets
|
|
|
13
13
|
synchronized_fetch(key)
|
|
14
14
|
rescue KeyError
|
|
15
15
|
if secrets_files.present?
|
|
16
|
-
raise
|
|
16
|
+
raise Dash::ConfigurationError, "Secret '#{key}' not found in #{secrets_files.join(", ")}"
|
|
17
17
|
else
|
|
18
|
-
raise
|
|
18
|
+
raise Dash::ConfigurationError, "Secret '#{key}' not found, no secret files (#{secrets_filenames.join(", ")}) provided"
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
data/lib/{kamal → dash}/tags.rb
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "time"
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class Dash::Tags
|
|
4
4
|
attr_reader :config, :tags
|
|
5
5
|
|
|
6
6
|
class << self
|
|
@@ -10,7 +10,7 @@ class Kamal::Tags
|
|
|
10
10
|
|
|
11
11
|
def default_tags(config)
|
|
12
12
|
{ recorded_at: Time.now.utc.iso8601,
|
|
13
|
-
performer:
|
|
13
|
+
performer: Dash::Git.email.presence || `whoami`.chomp,
|
|
14
14
|
destination: config.destination,
|
|
15
15
|
version: config.version,
|
|
16
16
|
service_version: service_version(config),
|
|
@@ -26,8 +26,13 @@ class Kamal::Tags
|
|
|
26
26
|
@tags = tags.compact
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
# Both prefixes carry the same value: hooks are operator-written and apps read
|
|
30
|
+
# these at runtime, so the old names stay until 5.0 (zoolutions/dash#118).
|
|
29
31
|
def env
|
|
30
|
-
tags.
|
|
32
|
+
tags.each_with_object({}) do |(detail, value), env|
|
|
33
|
+
env["DASH_#{detail.upcase}"] = value
|
|
34
|
+
env["KAMAL_#{detail.upcase}"] = value
|
|
35
|
+
end
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
def to_s
|
data/lib/{kamal → dash}/utils.rb
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "active_support/core_ext/object/try"
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module Dash::Utils
|
|
4
4
|
extend self
|
|
5
5
|
|
|
6
6
|
DOLLAR_SIGN_WITHOUT_SHELL_EXPANSION_REGEX = /\$(?!{[^\}]*\})/
|
|
@@ -31,13 +31,13 @@ module Kamal::Utils
|
|
|
31
31
|
"--#{key}"
|
|
32
32
|
else
|
|
33
33
|
rendered = "--#{key}#{with}#{escape ? escape_shell_value(value) : value}"
|
|
34
|
-
value.is_a?(
|
|
34
|
+
value.is_a?(Dash::Utils::Sensitive) ? sensitive(rendered, redaction: "--#{key}#{with}#{value.redaction}") : rendered
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
else
|
|
38
38
|
flatten_args(args).collect do |(key, value)|
|
|
39
39
|
rendered = value == true ? nil : escape ? escape_shell_value(value) : value
|
|
40
|
-
rendered = sensitive(rendered, redaction: value.redaction) if value.is_a?(
|
|
40
|
+
rendered = sensitive(rendered, redaction: value.redaction) if value.is_a?(Dash::Utils::Sensitive)
|
|
41
41
|
[ "--#{key}", rendered ]
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -45,10 +45,20 @@ module Kamal::Utils
|
|
|
45
45
|
options.flatten.compact
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
#
|
|
48
|
+
# dash-proxy takes durations as Go duration strings; deploy.yml takes plain
|
|
49
49
|
# seconds. Zero is a real value (it disables the timeout), so only nil drops out.
|
|
50
|
+
#
|
|
51
|
+
# A value that already carries a unit is passed through untouched. Appending
|
|
52
|
+
# "s" to it would not just be redundant, it would change the meaning: "5m"
|
|
53
|
+
# would become "5ms", which Go parses happily as five milliseconds. An
|
|
54
|
+
# operator who writes a Go duration should get the duration they wrote or an
|
|
55
|
+
# error from the proxy, never a silently different one.
|
|
56
|
+
NUMERIC_DURATION = /\A-?\d+(\.\d+)?\z/
|
|
57
|
+
|
|
50
58
|
def seconds_duration(value)
|
|
51
|
-
|
|
59
|
+
return if value.nil?
|
|
60
|
+
|
|
61
|
+
value.to_s.match?(NUMERIC_DURATION) ? "#{value}s" : value.to_s
|
|
52
62
|
end
|
|
53
63
|
|
|
54
64
|
# Flattens a one-to-many structure into an array of two-element arrays each containing a key-value pair
|
|
@@ -60,7 +70,7 @@ module Kamal::Utils
|
|
|
60
70
|
# Pass `redaction:` to change the default `"[REDACTED]"` redaction, e.g.
|
|
61
71
|
# `sensitive "#{arg}=#{secret}", redaction: "#{arg}=xxxx"
|
|
62
72
|
def sensitive(...)
|
|
63
|
-
|
|
73
|
+
Dash::Utils::Sensitive.new(...)
|
|
64
74
|
end
|
|
65
75
|
|
|
66
76
|
def redacted(value)
|
data/lib/dash/version.rb
ADDED
data/lib/{kamal.rb → dash.rb}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Dash
|
|
2
2
|
class ConfigurationError < StandardError; end
|
|
3
3
|
end
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ require "yaml"
|
|
|
8
8
|
require "tmpdir"
|
|
9
9
|
require "pathname"
|
|
10
10
|
require "uri"
|
|
11
|
-
# Proxy::Run.digest reaches for Digest::SHA256 from inside `on(
|
|
11
|
+
# Proxy::Run.digest reaches for Digest::SHA256 from inside `on(DASH.proxy_hosts)`,
|
|
12
12
|
# so the first reference happens in several SSHKit threads at once. Digest defines
|
|
13
13
|
# SHA256 lazily — `Digest.const_missing(:SHA256)` runs `require "digest/sha2"`, and
|
|
14
14
|
# that path is not mutex-guarded — so the threads race it and one loses with
|
|
@@ -21,6 +21,6 @@ require "uri"
|
|
|
21
21
|
require "digest/sha2"
|
|
22
22
|
|
|
23
23
|
loader = Zeitwerk::Loader.for_gem
|
|
24
|
-
loader.ignore(File.join(__dir__, "
|
|
24
|
+
loader.ignore(File.join(__dir__, "dash", "sshkit_with_ext.rb"))
|
|
25
25
|
loader.setup
|
|
26
|
-
loader.eager_load_namespace(
|
|
26
|
+
loader.eager_load_namespace(Dash::Cli) # We need all commands loaded.
|