github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/juju/common/gui.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package common
     5  
     6  import (
     7  	"os"
     8  
     9  	"github.com/juju/juju/environs/gui"
    10  )
    11  
    12  const guiBaseURLEnvVar = "JUJU_GUI_SIMPLESTREAMS_URL"
    13  
    14  // GUIDataSourceBaseURL returns the default base URL to use for the Juju GUI
    15  // simplestreams data source. The default value can be overridden by setting
    16  // the JUJU_GUI_SIMPLESTREAMS_URL environment variable.
    17  func GUIDataSourceBaseURL() string {
    18  	url := os.Getenv(guiBaseURLEnvVar)
    19  	if url != "" {
    20  		return url
    21  	}
    22  	return gui.DefaultBaseURL
    23  }