WritePluginConfig writes the plugin config to config.json in the plugin home directory.
()
| 143 | // WritePluginConfig writes the plugin config to config.json in the plugin home |
| 144 | // directory. |
| 145 | func (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 | } |
nothing calls this directly
no test coverage detected