Files
opencloud/vendor/github.com/a8m/envsubst/parse/env.go
Thomas Müller bdbba929d0 feat: add CSP and other security related headers in the oCIS proxy service (#8777)
* feat: add CSP and other security related headers in the oCIS proxy service

* fix: consolidate security related headers - drop middleware.Secure

* fix: use github.com/DeepDiver1975/secure

* fix: acceptance tests

* feat: support env var replacements in csp.yaml
2024-04-26 09:10:35 +02:00

28 lines
408 B
Go

package parse
import (
"strings"
)
type Env []string
func (e Env) Get(name string) string {
v, _ := e.Lookup(name)
return v
}
func (e Env) Has(name string) bool {
_, ok := e.Lookup(name)
return ok
}
func (e Env) Lookup(name string) (string, bool) {
prefix := name + "="
for _, pair := range e {
if strings.HasPrefix(pair, prefix) {
return pair[len(prefix):], true
}
}
return "", false
}