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

Function writeConfig

coderd/devtunnel/tunnel.go:188–205  ·  view source on GitHub ↗
(cfg Config)

Source from the content-addressed store, hash-verified

186}
187
188func writeConfig(cfg Config) error {
189 cfgFi, err := cfgPath()
190 if err != nil {
191 return xerrors.Errorf("get config path: %w", err)
192 }
193
194 raw, err := json.Marshal(cfg)
195 if err != nil {
196 return xerrors.Errorf("marshal config: %w", err)
197 }
198
199 err = os.WriteFile(cfgFi, raw, 0o600)
200 if err != nil {
201 return xerrors.Errorf("write file: %w", err)
202 }
203
204 return nil
205}

Callers 1

readOrGenerateConfigFunction · 0.70

Calls 4

cfgPathFunction · 0.85
WriteFileMethod · 0.65
ErrorfMethod · 0.45
MarshalMethod · 0.45

Tested by

no test coverage detected