mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 04:00:25 +03:00
Final changes to config sub-system (#8600)
- Introduces changes such as certain types of errors that can be ignored or which need to go into safe mode. - Update help text as per the review
This commit is contained in:
committed by
kannappanr
parent
794eb54da8
commit
c9940d8c3f
@@ -41,10 +41,6 @@ const (
|
||||
// DefaultKVS - default config for OPA config
|
||||
var (
|
||||
DefaultKVS = config.KVS{
|
||||
config.KV{
|
||||
Key: config.State,
|
||||
Value: config.StateOff,
|
||||
},
|
||||
config.KV{
|
||||
Key: URL,
|
||||
Value: "",
|
||||
@@ -112,6 +108,11 @@ type Opa struct {
|
||||
client *http.Client
|
||||
}
|
||||
|
||||
// Enabled returns if opa is enabled.
|
||||
func Enabled(kvs config.KVS) bool {
|
||||
return kvs.Get(URL) != ""
|
||||
}
|
||||
|
||||
// LookupConfig lookup Opa from config, override with any ENVs.
|
||||
func LookupConfig(kv config.KVS, transport *http.Transport, closeRespFn func(io.ReadCloser)) (Args, error) {
|
||||
args := Args{}
|
||||
|
||||
@@ -23,18 +23,18 @@ var (
|
||||
Help = config.HelpKVS{
|
||||
config.HelpKV{
|
||||
Key: URL,
|
||||
Description: `Points to URL for OPA HTTP API endpoint. eg: "http://localhost:8181/v1/data/httpapi/authz/allow"`,
|
||||
Description: `OPA HTTP API endpoint e.g. "http://localhost:8181/v1/data/httpapi/authz/allow"`,
|
||||
Type: "url",
|
||||
},
|
||||
config.HelpKV{
|
||||
Key: AuthToken,
|
||||
Description: "Authorization token for the OPA HTTP API endpoint",
|
||||
Description: "authorization token for OPA HTTP API endpoint",
|
||||
Optional: true,
|
||||
Type: "string",
|
||||
},
|
||||
config.HelpKV{
|
||||
Key: config.Comment,
|
||||
Description: "A comment to describe the OPA policy setting",
|
||||
Description: config.DefaultComment,
|
||||
Optional: true,
|
||||
Type: "sentence",
|
||||
},
|
||||
|
||||
@@ -33,10 +33,6 @@ func SetPolicyOPAConfig(s config.Config, opaArgs Args) {
|
||||
return
|
||||
}
|
||||
s[config.PolicyOPASubSys][config.Default] = config.KVS{
|
||||
config.KV{
|
||||
Key: config.State,
|
||||
Value: config.StateOn,
|
||||
},
|
||||
config.KV{
|
||||
Key: URL,
|
||||
Value: opaArgs.URL.String(),
|
||||
|
||||
Reference in New Issue
Block a user