module Commands::Url

Public Instance Methods

url( app_id = Services::AppConfig.get_or_exit('app'), environment_name = Services::AppConfig.get_or_exit('environment') ) click to toggle source
# File lib/busbar_cli/commands/url.rb, line 24
def url(
  app_id = Services::AppConfig.get_or_exit('app'),
  environment_name = Services::AppConfig.get_or_exit('environment')
)
  Services::Kube.configure_temporary_profile(options.profile)

  environment = EnvironmentsRepository.find(
    app_id: app_id,
    environment_name: environment_name
  )

  url = if options.internal
          Services::Url.internal(environment)
        elsif options.ingress || !environment.public
          Services::Url.ingress(environment)
        elsif options.public
          Services::Url.public(environment)
        end

  puts url
end