class Kontena::Cli::Nodes::EnvCommand
Public Instance Methods
execute()
click to toggle source
# File lib/kontena/cli/nodes/env_command.rb, line 24 def execute unless token_node = get_node_token() exit_with_error "Node #{name} was not created with a node token. Use `kontena grid env` instead" end if self.token? puts token_node['token'] else puts "KONTENA_URI=#{grid_uri}" puts "KONTENA_NODE_TOKEN=#{token_node['token']}" end end
get_node_token()
click to toggle source
# File lib/kontena/cli/nodes/env_command.rb, line 17 def get_node_token return client.get("nodes/#{current_grid}/#{name}/token") rescue Kontena::Errors::StandardError => exc raise unless exc.status == 404 return nil end
grid_uri()
click to toggle source
# File lib/kontena/cli/nodes/env_command.rb, line 13 def grid_uri grid_uri = self.current_master['url'].sub('http', 'ws') end