Sha256: e7f2a31575951c1f95350633053366f8a38f28fcbc072bc0bf98daa8b3ff4c40

Contents?: true

Size: 652 Bytes

Versions: 4

Compression:

Stored size: 652 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class EnvCommand < Clamp::Command
    include Kontena::Cli::Common
    include Common

    option ["-e", "--export"], :flag, "Add export", default: false

    def execute
      require_api_url
      if current_grid.nil?
        abort 'No grid selected. To select grid, please run: kontena grid use <grid name>'
      else
        grid = client(require_token).get("grids/#{current_grid}")
        prefix = export? ? 'export ' : ''
        puts "#{prefix}KONTENA_URI=#{settings['server']['url'].sub('http', 'ws')}"
        puts "#{prefix}KONTENA_TOKEN=#{grid['token']}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kontena-cli-0.10.3 lib/kontena/cli/grids/env_command.rb
kontena-cli-0.10.2 lib/kontena/cli/grids/env_command.rb
kontena-cli-0.10.1 lib/kontena/cli/grids/env_command.rb
kontena-cli-0.10.0 lib/kontena/cli/grids/env_command.rb