MCPcopy Index your code
hub / github.com/coder/coder / WithoutSecrets

Method WithoutSecrets

codersdk/deployment.go:4938–4969  ·  view source on GitHub ↗

WithoutSecrets returns a copy of the config without secret values.

()

Source from the content-addressed store, hash-verified

4936
4937// WithoutSecrets returns a copy of the config without secret values.
4938func (c *DeploymentValues) WithoutSecrets() (*DeploymentValues, error) {
4939 var ff DeploymentValues
4940
4941 // Create copy via JSON.
4942 byt, err := json.Marshal(c)
4943 if err != nil {
4944 return nil, err
4945 }
4946 err = json.Unmarshal(byt, &ff)
4947 if err != nil {
4948 return nil, err
4949 }
4950
4951 for _, opt := range ff.Options() {
4952 if !IsSecretDeploymentOption(opt) {
4953 continue
4954 }
4955
4956 // This only works with string values for now.
4957 switch v := opt.Value.(type) {
4958 case *serpent.String, *serpent.StringArray:
4959 err := v.Set("")
4960 if err != nil {
4961 panic(err)
4962 }
4963 default:
4964 return nil, xerrors.Errorf("unsupported type %T", v)
4965 }
4966 }
4967
4968 return &ff, nil
4969}
4970
4971// DeploymentConfig returns the deployment config for the coder server.
4972func (c *Client) DeploymentConfig(ctx context.Context) (*DeploymentConfig, error) {

Callers 2

deploymentValuesMethod · 0.80
ServerMethod · 0.80

Calls 6

OptionsMethod · 0.95
IsSecretDeploymentOptionFunction · 0.85
SetMethod · 0.65
MarshalMethod · 0.45
UnmarshalMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected