added hmac validation to http based api

This commit is contained in:
cdramey committed 2021-03-01 07:26:27 -09:00
1 parent 5c50f4ac95
commit 5571401103
5 files changed
+114 -16

No files matched your search

+3 -3
View File
@@ -14,7 +14,7 @@ type Config struct {
DebugLevel int
Listen string
Path string
APIKey string
APIKey []byte
APIKeyFile string
}
@@ -77,12 +77,12 @@ func ReadConfig(fn string, debuglvl int) (*Config, error) {
return nil, err
}
if cfg.APIKey == "" {
if len(cfg.APIKey) == 0 {
b, err := os.ReadFile(cfg.APIKeyFile)
if err != nil {
return nil, err
}
cfg.APIKey = string(b)
cfg.APIKey = b
}
return cfg, nil
+1 -1
View File
@@ -71,7 +71,7 @@ func (p *parser) parse() error {
case "listen":
p.config.Listen = value
case "api.key":
p.config.APIKey = value
p.config.APIKey = []byte(value)
case "api.keyfile":
p.config.APIKeyFile = value
default: