-
Notifications
You must be signed in to change notification settings - Fork 21
PMM-4879 Adding support for defaults-file. #356
base: main
Are you sure you want to change the base?
Conversation
defaultsfile/defaults_file.go
Outdated
} | ||
|
||
// ParseDefaultsFile parses given defaultsFile. It returns the database specs. | ||
func (d *DefaultsFile) ParseDefaultsFile(req *agentpb.ParseDefaultsFileRequest) *agentpb.ParseDefaultsFileResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's create one more struct like DefaultsFileParser with no fields and make this method part of it.
because TBH it looks weird that DefaultsFile has method which calls another function which returns DefaultsFile and fields of it used. So I think having separate struct will make code cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Just created "Parser" struct because package is "defaultsfile" and with DefaultsFileParser linter raises error about stuttering. type name will be used as defaultsfile.DefaultsFileParser by other packages, and that stutters
defaultsfile/defaults_file.go
Outdated
) | ||
|
||
// DefaultsFile is a struct with database specs fetched from file. | ||
type DefaultsFile struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case of new struct DefaultFileParser
, DefaultsFile
can be private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great remark. Thank you, changed.
|
||
return &defaultsFile{ | ||
username: cfgSection.Key("user").String(), | ||
password: cfgSection.Key("password").String(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later password need to be encrypted, please create related ticket so that we don't forget about it
PMM-4879
Build: SUBMODULES-2465
Build will fail because I cannot use forked version of api (pmm) as dependency in mod.go. To acomplish this, api needs be merged and version of pmm api should be bumped.