faas-cli: github.com/openfaas/faas-cli/config Index | Files

package config

import "github.com/openfaas/faas-cli/config"


Package Files



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


var (
    DefaultDir  = "~/.openfaas"
    DefaultFile = "config.yml"

func DecodeAuth Uses

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

DecodeAuth decodes the input string from base64 to username and password

func EncodeAuth Uses

func EncodeAuth(username string, password string) string

EncodeAuth encodes the username and password strings to base64

func EnsureFile Uses

func EnsureFile() (string, error)

EnsureFile creates the root dir and config file

func RemoveAuthConfig Uses

func RemoveAuthConfig(gateway string) error

RemoveAuthConfig deletes the username and password for a given gateway

func UpdateAuthConfig Uses

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

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

type AuthConfig Uses

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

func LookupAuthConfig Uses

func LookupAuthConfig(gateway string) (AuthConfig, error)

LookupAuthConfig returns the username and password for a given gateway

type AuthType Uses

type AuthType string

AuthType auth type

type ConfigFile Uses

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

ConfigFile for OpenFaaS CLI exclusively.

func New Uses

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

New initializes a config file for the given file path

Package config imports 10 packages (graph) and is imported by 11 packages. Updated 2020-06-07. Refresh now. Tools for package owners.