MCPcopy
hub / github.com/dnote/dnote / Read

Function Read

pkg/cli/config/config.go:62–77  ·  view source on GitHub ↗

Read reads the config file

(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

60
61// Read reads the config file
62func Read(ctx context.DnoteCtx) (Config, error) {
63 var ret Config
64
65 configPath := GetPath(ctx)
66 b, err := os.ReadFile(configPath)
67 if err != nil {
68 return ret, errors.Wrap(err, "reading config file")
69 }
70
71 err = yaml.Unmarshal(b, &ret)
72 if err != nil {
73 return ret, errors.Wrap(err, "unmarshalling config")
74 }
75
76 return ret, nil
77}
78
79// Write writes the config to the config file
80func Write(ctx context.DnoteCtx, cf Config) error {

Callers 3

setupCtxFunction · 0.92
TestInit_APIEndpointFunction · 0.92
migrations.goFile · 0.92

Calls 1

GetPathFunction · 0.70

Tested by 1

TestInit_APIEndpointFunction · 0.74