MCPcopy Index your code
hub / github.com/cloudfoundry/cli / WritePluginConfig

Method WritePluginConfig

util/configv3/plugins_config.go:145–160  ·  view source on GitHub ↗

WritePluginConfig writes the plugin config to config.json in the plugin home directory.

()

Source from the content-addressed store, hash-verified

143// WritePluginConfig writes the plugin config to config.json in the plugin home
144// directory.
145func (config *Config) WritePluginConfig() error {
146 // Marshal JSON
147 rawConfig, err := json.MarshalIndent(config.pluginsConfig, "", " ")
148 if err != nil {
149 return err
150 }
151
152 pluginFileDir := filepath.Join(config.PluginHome())
153 err = os.MkdirAll(pluginFileDir, 0700)
154 if err != nil {
155 return err
156 }
157
158 // Write to file
159 return os.WriteFile(filepath.Join(pluginFileDir, "config.json"), rawConfig, 0600)
160}

Callers

nothing calls this directly

Implementers 1

FakeConfigcommand/commandfakes/fake_config.go

Calls 1

PluginHomeMethod · 0.95

Tested by

no test coverage detected