mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-21 17:01:57 -04:00
* 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
28 lines
408 B
Go
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
|
|
}
|