5
"launchpad.net/juju-core/environs/config"
8
// Open creates a new Environ using the environment configuration with the
9
// given name. If name is empty, the default environment will be used.
10
func (envs *Environs) Open(name string) (Environ, error) {
14
return nil, fmt.Errorf("no default environment found")
17
e, ok := envs.environs[name]
19
return nil, fmt.Errorf("unknown environment %q", name)
27
// NewFromName opens the environment with the given
28
// name from the default environments file. If the
29
// name is blank, the default environment will be used.
30
func NewFromName(name string) (Environ, error) {
31
environs, err := ReadEnvirons("")
35
return environs.Open(name)
38
// NewFromAttrs returns a new environment based on the provided configuration
40
func NewFromAttrs(attrs map[string]interface{}) (Environ, error) {
41
cfg, err := config.New(attrs)
48
// New returns a new environment based on the provided configuration.
49
func New(config *config.Config) (Environ, error) {
50
p, err := Provider(config.Type())