Documentation ¶
Index ¶
- Constants
- func ConfigDir() string
- func DecodeAuth(input string) (string, string, error)
- func EncodeAuth(username string, password string) string
- func EnsureFile() (string, error)
- func RemoveAuthConfig(gateway string) error
- func UpdateAuthConfig(gateway, token string, authType AuthType) error
- type AuthConfig
- type AuthType
- type ConfigFile
Constants ¶
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 ¶
DecodeAuth decodes the input string from base64 to username and password
func EncodeAuth ¶
EncodeAuth encodes the username and password strings to base64
func RemoveAuthConfig ¶
RemoveAuthConfig deletes the username and password for a given gateway
func UpdateAuthConfig ¶
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 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