mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
feat: add YAML support to server (#6934)
This commit is contained in:
29
coderd/apidoc/docs.go
generated
29
coderd/apidoc/docs.go
generated
@ -5721,12 +5721,6 @@ const docTemplate = `{
|
||||
"clibase.Group": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/clibase.Group"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -5735,6 +5729,9 @@ const docTemplate = `{
|
||||
},
|
||||
"parent": {
|
||||
"$ref": "#/definitions/clibase.Group"
|
||||
},
|
||||
"yaml": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -5803,6 +5800,9 @@ const docTemplate = `{
|
||||
"value": {
|
||||
"description": "Value includes the types listed in values.go."
|
||||
},
|
||||
"value_source": {
|
||||
"$ref": "#/definitions/clibase.ValueSource"
|
||||
},
|
||||
"yaml": {
|
||||
"description": "YAML is the YAML key used to configure this option. If unset, YAML\nconfiguring is disabled.",
|
||||
"type": "string"
|
||||
@ -5883,6 +5883,23 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"clibase.ValueSource": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"",
|
||||
"flag",
|
||||
"env",
|
||||
"yaml",
|
||||
"default"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ValueSourceNone",
|
||||
"ValueSourceFlag",
|
||||
"ValueSourceEnv",
|
||||
"ValueSourceYAML",
|
||||
"ValueSourceDefault"
|
||||
]
|
||||
},
|
||||
"coderd.SCIMUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
23
coderd/apidoc/swagger.json
generated
23
coderd/apidoc/swagger.json
generated
@ -5066,12 +5066,6 @@
|
||||
"clibase.Group": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/clibase.Group"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -5080,6 +5074,9 @@
|
||||
},
|
||||
"parent": {
|
||||
"$ref": "#/definitions/clibase.Group"
|
||||
},
|
||||
"yaml": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -5148,6 +5145,9 @@
|
||||
"value": {
|
||||
"description": "Value includes the types listed in values.go."
|
||||
},
|
||||
"value_source": {
|
||||
"$ref": "#/definitions/clibase.ValueSource"
|
||||
},
|
||||
"yaml": {
|
||||
"description": "YAML is the YAML key used to configure this option. If unset, YAML\nconfiguring is disabled.",
|
||||
"type": "string"
|
||||
@ -5228,6 +5228,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"clibase.ValueSource": {
|
||||
"type": "string",
|
||||
"enum": ["", "flag", "env", "yaml", "default"],
|
||||
"x-enum-varnames": [
|
||||
"ValueSourceNone",
|
||||
"ValueSourceFlag",
|
||||
"ValueSourceEnv",
|
||||
"ValueSourceYAML",
|
||||
"ValueSourceDefault"
|
||||
]
|
||||
},
|
||||
"coderd.SCIMUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -1108,7 +1108,7 @@ QastnN77KfUwdj3SJt44U/uh1jAIv4oSLBr8HYUkbnI8
|
||||
func DeploymentValues(t *testing.T) *codersdk.DeploymentValues {
|
||||
var cfg codersdk.DeploymentValues
|
||||
opts := cfg.Options()
|
||||
err := opts.SetDefaults(nil)
|
||||
err := opts.SetDefaults()
|
||||
require.NoError(t, err)
|
||||
return &cfg
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package rbac
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
)
|
||||
@ -10,7 +12,7 @@ const (
|
||||
// errUnauthorized is the error message that should be returned to
|
||||
// clients when an action is forbidden. It is intentionally vague to prevent
|
||||
// disclosing information that a client should not have access to.
|
||||
errUnauthorized = "forbidden"
|
||||
errUnauthorized = "rbac: forbidden"
|
||||
)
|
||||
|
||||
// UnauthorizedError is the error type for authorization errors
|
||||
@ -51,8 +53,18 @@ func (e UnauthorizedError) Unwrap() error {
|
||||
return e.internal
|
||||
}
|
||||
|
||||
func (e *UnauthorizedError) longError() string {
|
||||
return fmt.Sprintf(
|
||||
"%s: (subject: %v), (action: %v), (object: %v), (output: %v)",
|
||||
errUnauthorized, e.subject, e.action, e.object, e.output,
|
||||
)
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (UnauthorizedError) Error() string {
|
||||
func (e UnauthorizedError) Error() string {
|
||||
if flag.Lookup("test.v") != nil {
|
||||
return e.longError()
|
||||
}
|
||||
return errUnauthorized
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user