config

package
v0.0.0-...-16aecd9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//BasicAuthType basic authentication type
	BasicAuthType = "basic"
	//Oauth2AuthType oauth2 authentication type
	Oauth2AuthType = "oauth2"

	// ConfigLocationEnv is the name of he env variable used
	// to configure the location of the faas-cli config folder.
	// When not set, DefaultDir location is used.
	ConfigLocationEnv string = "OPENFAAS_CONFIG"

	DefaultDir         string      = "~/.openfaas"
	DefaultFile        string      = "config.yml"
	DefaultPermissions os.FileMode = 0700

	// DefaultCIDir creates the 'openfaas' directory in the current directory
	// if running in a CI environment.
	DefaultCIDir string = ".openfaas"
	// DefaultCIPermissions creates the config file with elevated permissions
	// for it to be read by multiple users when running in a CI environment.
	DefaultCIPermissions os.FileMode = 0744
)

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the path to the faas-cli config directory. When 1. CI = "true" and OPENFAAS_CONFIG="", then it will return `.openfaas`, which is located in the current working directory. 2. CI = "true" and OPENFAAS_CONFIG="<path>", then it will return the path value in OPENFAAS_CONFIG 3. CI = "" and OPENFAAS_CONFIG="", then it will return the default location ~/.openfaas

func DecodeAuth

func DecodeAuth(input string) (string, string, error)

DecodeAuth decodes the input string from base64 to username and password

func EncodeAuth

func EncodeAuth(username string, password string) string

EncodeAuth encodes the username and password strings to base64

func EnsureFile

func EnsureFile() (string, error)

EnsureFile creates the root dir and config file

func RemoveAuthConfig

func RemoveAuthConfig(gateway string) error

RemoveAuthConfig deletes the username and password for a given gateway

func UpdateAuthConfig

func UpdateAuthConfig(gateway, token string, authType AuthType) error

UpdateAuthConfig creates or updates the username and password for a given gateway

Types

type AuthConfig

type AuthConfig struct {
	Gateway string   `yaml:"gateway,omitempty"`
	Auth    AuthType `yaml:"auth,omitempty"`
	Token   string   `yaml:"token,omitempty"`
}

func LookupAuthConfig

func LookupAuthConfig(gateway string) (AuthConfig, error)

LookupAuthConfig returns the username and password for a given gateway

type AuthType

type AuthType string

AuthType auth type

type ConfigFile

type ConfigFile struct {
	AuthConfigs []AuthConfig `yaml:"auths"`
	FilePath    string       `yaml:"-"`
}

ConfigFile for OpenFaaS CLI exclusively.

func New

func New(filePath string) (*ConfigFile, error)

New initializes a config file for the given file path

Jump to

Keyboard shortcuts

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