Sha256: 58301d104f87e4120a77132d9a8e67099d82c9aec3d17cd44c82a66bd8924d61
Contents?: true
Size: 927 Bytes
Versions: 5
Compression:
Stored size: 927 Bytes
Contents
require_relative 'common' module Kontena::Cli::Grids class EnvCommand < Kontena::Command include Kontena::Cli::Common include Common parameter "[NAME]", "Grid name" option ["-e", "--export"], :flag, "Add export", default: false def execute require_api_url name_or_current = name.nil? ? current_grid : name if name_or_current.nil? abort "No grid selected. Use: kontena grid env <name>, or select a grid with: kontena grid use <name>" else grid = find_grid_by_name(name_or_current) abort("Grid not found".colorize(:red)) unless grid prefix = export? ? 'export ' : '' server = settings['servers'].find{|s| s['name'] == settings['current_server']} if server puts "#{prefix}KONTENA_URI=#{server['url'].sub('http', 'ws')}" puts "#{prefix}KONTENA_TOKEN=#{server['token']}" end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems