[MM-19711] - Get plugin configuration without removing secrets (#11928)
* Method GetUnsanitizedConfig() exposed to API (Plugin) interface and his implementations * improvements with some suggestions * Fix documentation (final period added) Co-Authored-By: Ali Farooq <25732808+ali-farooq0@users.noreply.github.com> * Added some test for Plugin.GetConfig and Plugin.GetUnsanitizedConfig * Removed empty lines
Этот коммит содержится в:
коммит произвёл
Ali Farooq
родитель
5aa24aedc8
Коммит
65f03de1ee
@@ -588,6 +588,33 @@ func (s *apiRPCServer) GetConfig(args *Z_GetConfigArgs, returns *Z_GetConfigRetu
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetUnsanitizedConfigArgs struct {
|
||||
}
|
||||
|
||||
type Z_GetUnsanitizedConfigReturns struct {
|
||||
A *model.Config
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetUnsanitizedConfig() *model.Config {
|
||||
_args := &Z_GetUnsanitizedConfigArgs{}
|
||||
_returns := &Z_GetUnsanitizedConfigReturns{}
|
||||
if err := g.client.Call("Plugin.GetUnsanitizedConfig", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetUnsanitizedConfig API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetUnsanitizedConfig(args *Z_GetUnsanitizedConfigArgs, returns *Z_GetUnsanitizedConfigReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetUnsanitizedConfig() *model.Config
|
||||
}); ok {
|
||||
returns.A = hook.GetUnsanitizedConfig()
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetUnsanitizedConfig called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_SaveConfigArgs struct {
|
||||
A *model.Config
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user