config

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (

	// TestPath can be used for testing purposes
	TestPath = "mock_location.json"
)

Variables

This section is empty.

Functions

func Marshal added in v0.2.0

func Marshal(in interface{}, fileExt string) ([]byte, error)

Marshal converts the passed object into byte data, based on the specified file format

func Unmarshal added in v0.2.0

func Unmarshal(in []byte, out interface{}, fileExt string) error

Unmarshal converts the passed byte data into a struct

Types

type CfgHandler added in v0.2.0

type CfgHandler struct {
	// Pointer to an instance of the host CLI config struct
	Cfg *Config

	// Path of the local config file
	FilePath string
	// contains filtered or unexported fields
}

CfgHandler defines the fields required to manage config.

func NewHandler added in v0.2.0

func NewHandler(cfg *Config) (*CfgHandler, error)

NewHandler links the specified arguments to a new instance of config handler and returns a pointer to it.

func (*CfgHandler) Load added in v0.2.0

func (h *CfgHandler) Load() error

Load reads config values from the local config file (using the file path linked to the handler) and stores them into the linked instance of host CLI config struct.

func (*CfgHandler) Save added in v0.2.0

func (h *CfgHandler) Save() error

Save writes config values from the linked instance of host CLI config struct to the local config file (using the file path linked to the handler).

type Config

type Config struct {
	// ServiceRegistry *ServiceRegistryConfig `json:"serviceregistry"`
	InstanceID string `json:"instanceId"`
	Name       string `json:"name"`

	AccessToken       string   `json:"access_token" doc:"Bearer access token."`
	RefreshToken      string   `json:"refresh_token" doc:"Offline or refresh token."`
	MasAuthURL        string   `json:"mas_auth_url"`
	MasAccessToken    string   `json:"mas_access_token"`
	MasRefreshToken   string   `json:"mas_refresh_token"`
	APIUrl            string   `` /* 156-byte string literal not displayed */
	AuthURL           string   `json:"auth_url" doc:"URL of the authentication server"`
	ClientID          string   `json:"client_id" doc:"OpenID client identifier."`
	Insecure          bool     `` /* 132-byte string literal not displayed */
	Scopes            []string `` /* 162-byte string literal not displayed */
	DevPreviewEnabled bool     `json:"dev_preview_enabled" doc:"Enables Developer preview commands"`
}

Config is a type which describes the properties which can be in the config

func (*Config) HasServiceRegistry

func (c *Config) HasServiceRegistry() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL