Ejemplo n.º 1
0
// EnvironmentGet implements the server-side part of the
// get-environment CLI command.
func (c *Client) EnvironmentGet() (params.EnvironmentConfigResults, error) {
	result := params.EnvironmentConfigResults{}
	// Get the existing environment config from the state.
	config, err := c.api.state.EnvironConfig()
	if err != nil {
		return result, err
	}
	result.Config = config.AllAttrs()
	return result, nil
}
Ejemplo n.º 2
0
// EnvironmentConfig returns the environment config for the controller
// environment.  For information on the current environment, use
// client.EnvironmentGet
func (s *ControllerAPI) EnvironmentConfig() (params.EnvironmentConfigResults, error) {
	result := params.EnvironmentConfigResults{}

	stateServerEnv, err := s.state.ControllerEnvironment()
	if err != nil {
		return result, errors.Trace(err)
	}

	config, err := stateServerEnv.Config()
	if err != nil {
		return result, errors.Trace(err)
	}

	result.Config = config.AllAttrs()
	return result, nil
}