Sha256: a0912d0b1e1098fe9359f4cdf11bd9c7d57abcc44259ac70a23d1a1126a3e3a5

Contents?: true

Size: 800 Bytes

Versions: 19

Compression:

Stored size: 800 Bytes

Contents

module SecretsCli
  class Init
    include SecretsCli::Helpers

    attr_reader :options

    def initialize(options)
      @options = options
    end

    def call
      SecretsCli::Configuration.write(config)
      prompt.ok "Written in #{SECRETS_CONFIG_FILE}:"
      prompt.ok File.read(SECRETS_CONFIG_FILE)
    end

    private

    def config
      {
        secrets_file: secrets_file,
        secrets_storage_key: secrets_storage_key
      }
    end

    def secrets_file
      @secrets_file ||= options.secrets_file || SecretsCli::Prompts::SecretsFile.new.call
    end

    def secrets_storage_key
      storage_key = options.secrets_storage_key || SecretsCli::Prompts::SecretsStorageKey.new.call
      storage_key << '/' unless storage_key.end_with?('/')
      storage_key
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
secrets_cli-1.10.0 lib/secrets_cli/init.rb
secrets_cli-1.9.0 lib/secrets_cli/init.rb
secrets_cli-1.8.0 lib/secrets_cli/init.rb
secrets_cli-1.7.0 lib/secrets_cli/init.rb
secrets_cli-1.6.0 lib/secrets_cli/init.rb
secrets_cli-1.5.0 lib/secrets_cli/init.rb
secrets_cli-1.4.2 lib/secrets_cli/init.rb
secrets_cli-1.4.1 lib/secrets_cli/init.rb
secrets_cli-1.4.0 lib/secrets_cli/init.rb
secrets_cli-1.3.3 lib/secrets_cli/init.rb
secrets_cli-1.3.2 lib/secrets_cli/init.rb
secrets_cli-1.3.1 lib/secrets_cli/init.rb
secrets_cli-1.3.0 lib/secrets_cli/init.rb
secrets_cli-1.2.0 lib/secrets_cli/init.rb
secrets_cli-1.1.0 lib/secrets_cli/init.rb
secrets_cli-1.0.0 lib/secrets_cli/init.rb
secrets_cli-0.4.0 lib/secrets_cli/init.rb
secrets_cli-0.3.1 lib/secrets_cli/init.rb
secrets_cli-0.3.0 lib/secrets_cli/init.rb