8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/easy_creds/actions/push.rb', line 8
def self.call(ctx)
env = ctx.env
Theme.section("Push — local → op://#{ctx.config.vault}/#{env}")
unless ctx.io.key_exists?(env)
return Theme.failure("No local key (config/credentials/#{env}.key). Run `init` or `pull` first.")
end
unless ctx.io.enc_exists?(env)
return Theme.failure("No local credentials (config/credentials/#{env}.yml.enc). Run `init` first.")
end
local_flat = Flatten.dot(ctx.io.read(env)).except(*ctx.config.ignore_keys)
vault_ok, item_ok = check_remote(ctx, env)
ensure_vault(ctx) unless vault_ok
item_ok ? update_existing(ctx, env, local_flat) : create_new(ctx, env, local_flat)
push_key_if_needed(ctx, env)
end
|