Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultConfigDir = filepath.Join(defaultUserConfigRoot, "bearpush")
DefaultConfigDir represents a default configuration directory of this application. Can be overridden by the user.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Path string
}
Config stores configuration of this application.
func LoadConfig ¶
LoadConfig the app configuration. If the config files do not exist on disk, they will be created.
type Context ¶
type Context struct { Config *Config Logger *zap.SugaredLogger Products map[string]*Product }
Context stores current application state.
func ContextFromConfig ¶
ContextFromConfig constructs a Context object from a loaded Config.
type Product ¶
type Product struct { Script string `yaml:"process-script"` TokenSettings TokenSettings `yaml:"token"` }
Product describes a type of entity Bearpush can process.
func LoadProductFromFile ¶
LoadProductFromFile loads product manifest from a file under a provided path.
func (*Product) VerifyToken ¶
VerifyToken checks whether a token can be considered valid, according to current strategy.
type TokenSettings ¶
type TokenSettings struct { Strategy TokenStrategy `yaml:"strategy"` Value *string `yaml:"static-value"` Script *string `yaml:"token-script"` }
TokenSettings describes how a Product validates incoming auth tokens.
type TokenStrategy ¶
type TokenStrategy int
TokenStrategy determines how the user tokens get validated.
const ( // StaticToken means there is a single token that will not change at runtime. StaticToken TokenStrategy // RetrieveToken means the possible tokens will be provided by a script. RetrieveToken // VerifyToken means each token will get verified by a script. VerifyToken )
func (TokenStrategy) String ¶
func (s TokenStrategy) String() string
String converts a Strategy to a string.
func (*TokenStrategy) UnmarshalYAML ¶
func (s *TokenStrategy) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML value to a TokenStrategy,