-
Notifications
You must be signed in to change notification settings - Fork 773
feature: add golbal dfget params to the dfdaemon config #771
Conversation
Codecov Report
@@ Coverage Diff @@
## master #771 +/- ##
=========================================
- Coverage 39.41% 39.21% -0.2%
=========================================
Files 108 108
Lines 6310 6309 -1
=========================================
- Hits 2487 2474 -13
- Misses 3618 3630 +12
Partials 205 205
Continue to review full report at Codecov.
|
dfdaemon/config/config.go
Outdated
Verbose bool `yaml:"verbose" json:"verbose"` | ||
|
||
MaxProcs int `yaml:"maxprocs" json:"maxprocs"` | ||
|
||
// dfget config | ||
GlobalDfgetParams []string `yaml:"global_dfget_params" json:"global_dfget_params"` |
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.
I don't think this should be a slice. Can we define a struct for this such as DfgetParams
? Then we can reuse it in proxy. And we can do some validation using this 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.
If that, we have to redefine a struct just like dfget config
.
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.
make sense
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.
just use dfgetflags
? And it should be assigned a default value.
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.
Can you provide an example configuration? Since we remove the flags, I think it is better to add a configuration with some default global dfget params.
11227bf
to
7f14569
Compare
I have added the corresponding comment in the code. In addition, we need to add a docs dir which including all docs about configuration files. And we should make it ASAP. |
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.
LGTM
dfdaemon/config/config.go
Outdated
Verbose bool `yaml:"verbose" json:"verbose"` | ||
|
||
MaxProcs int `yaml:"maxprocs" json:"maxprocs"` | ||
|
||
// dfget config | ||
GlobalDfgetParams []string `yaml:"global_dfget_params" json:"global_dfget_params"` |
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.
just use dfgetflags
? And it should be assigned a default value.
dfdaemon/downloader/dfget/dfget.go
Outdated
|
||
if dfGetter.config.Verbose { | ||
args = append(args, "--verbose") | ||
for _, param := range dfGetter.config.GlobalDfgetParams { |
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.
use args = append(args, dfGetter.config.GlobalDfgetParams...)
args = append(args, "--notbs") | ||
} | ||
|
||
if dfGetter.config.Verbose { |
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.
This should not be deleted if the --verbose
flag of dfdaemon
has been set.
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. PTAL again. THX
4d0eb89
to
a84c2a7
Compare
Signed-off-by: Starnop <[email protected]>
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.
LGTM
feature: add golbal dfget params to the dfdaemon config
feature: add golbal dfget params to the dfdaemon config
Signed-off-by: Gaius <[email protected]>
Signed-off-by: Starnop [email protected]
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes part of #687
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
TODO.
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
In my opition, I think it's not a good way to use CLI args to pass values to the dfget compared to the config file. So I have not added a flag for dfget params. @lowzj @yeya24 WDYT?
In this PR, I only add a
globalDfgetParams
through the dfdaemon config file firstly. And we can add adfgetParam
for every proxy later.In addition, there is one more thing we need to pay attention to: how should we verify the correctness of the dfget params? Do you have any good ideas?