Files
OliveTin/internal/config/config_helpers.go
James Read 1d446ace04 custom-webui and faster theme loading (#262)
* feature: custom-webui and faster theme loading

* feature: custom-webui and faster theme loading
2024-04-09 08:26:18 +00:00

53 lines
1008 B
Go

package config
// FindAction will return a action if there is a match on Title
func (cfg *Config) FindAction(actionTitle string) *Action {
for _, action := range cfg.Actions {
if action.Title == actionTitle {
return action
}
}
return nil
}
// FindArg will return an arg if there is a match on Name
func (action *Action) FindArg(name string) *ActionArgument {
if name == "stdout" || name == "exitCode" {
return &ActionArgument{
Name: name,
Type: "very_dangerous_raw_string",
}
}
return action.findArg(name)
}
func (action *Action) findArg(name string) *ActionArgument {
for _, arg := range action.Arguments {
if arg.Name == name {
return &arg
}
}
return nil
}
func (cfg *Config) FindAcl(aclTitle string) *AccessControlList {
for _, acl := range cfg.AccessControlLists {
if acl.Name == aclTitle {
return acl
}
}
return nil
}
func (cfg *Config) SetDir(dir string) {
cfg.usedConfigDir = dir
}
func (cfg *Config) GetDir() string {
return cfg.usedConfigDir
}