func (c *Config) GetMaxTimeout(scriptName string) float64 {
	for _, script := range c.Scripts {
		if script.Name == scriptName {
			if script.Timeout.MaxTimeout != nil {
				return *script.Timeout.MaxTimeout
			}
			break
		}
	}
	return 0
}
GetMaxTimeout returns the max_timeout for a given script name.
package config
import (
	"io/ioutil"
	"gopkg.in/yaml.v2"
)
type timeout struct {
	MaxTimeout *float64 `yaml:"max_timeout"`
	Enforced   *bool    `yaml:"enforced"`
}
type Config struct {
	TLS struct {
		Enabled bool   `yaml:"enabled"`
		Crt     string `yaml:"crt"`
		Key     string `yaml:"key"`
	} `yaml:"tls"`
	BasicAuth struct {
		Enabled  bool   `yaml:"enabled"`
		Username string `yaml:"username"`
		Password string `yaml:"password"`
	} `yaml:"basicAuth"`
	BearerAuth struct {
		Enabled    bool   `yaml:"enabled"`
		SigningKey string `yaml:"signingKey"`
	} `yaml:"bearerAuth"`
	Scripts []struct {
		Name    string `yaml:"name"`
		Script  string `yaml:"script"`
		Timeout timeout
	} `yaml:"scripts"`
}
func (c *Config) LoadConfig(file string) error {
	data, err := ioutil.ReadFile(file)
	if err != nil {
		return err
	}
	err = yaml.Unmarshal(data, &c)
	if err != nil {
		return err
	}
	return nil
}
func (c *Config) GetScript(scriptName string) string {
	for _, script := range c.Scripts {
		if script.Name == scriptName {
			return script.Script
		}
	}
	return ""
}