Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

fix(config): allow usage of full config struct#1683

Draft
nicklasfrahm wants to merge1 commit intogetsops:main
base:main
Choose a base branch
Loading
fromnicklasfrahm:feature/config-api

Conversation

nicklasfrahm
Copy link
Contributor

@nicklasfrahmnicklasfrahm commentedNov 24, 2024
edited
Loading

This allows the usage of the full configstruct in another Go program.

Closes#1682.

I added comments to edits that were not directly related to this PR, but that I considered a reduction of technical debt.

All tests pass locally.

Comment on lines -27 to -31
var log *logrus.Logger

func init() {
log = logging.NewLogger("CONFIG")
}
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I got a warning fromgo-staticcheck and I could not see this being used anywhere so I removed it to avoid the warning.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Better move the unrelated changes to a separate PR. That will increase the chance that these get merged, and make reviewing simpler generally.

Regarding this specific change:log and theinit() function were added ind3d0267. The last code usinglog was removed inebd153f. So there's definitely no reason to keep this.

err := yaml.Unmarshal(bytes, f)
if err != nil {
return fmt.Errorf("Could not unmarshal config file: %s", err)
return fmt.Errorf("could not unmarshal config file: %s", err)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This was also flagged bygo-staticcheck.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is a change that should go into a feature release and not into a bugfix release since it changes the observable behavior a bit and isn't a bugfix. Because of that I would keep it separate from the other changes.

Comment on lines -380 to -392
if dRule != nil {
if dRule.S3Bucket != "" && dRule.GCSBucket != "" && dRule.VaultPath != "" {
return nil, fmt.Errorf("error loading config: more than one destinations were found in a single destination rule, you can only use one per rule")
}
if dRule.S3Bucket != "" {
dest = publish.NewS3Destination(dRule.S3Bucket, dRule.S3Prefix)
}
if dRule.GCSBucket != "" {
dest = publish.NewGCSDestination(dRule.GCSBucket, dRule.GCSPrefix)
}
if dRule.VaultPath != "" {
dest = publish.NewVaultDestination(dRule.VaultAddress, dRule.VaultPath, dRule.VaultKVMountName, dRule.VaultKVVersion)
}
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This was flagged astautological condition: non-nil != nil bynilness.

felixfontein reacted with thumbs up emoji
Signed-off-by: Nicklas Frahm <nicklas.frahm@gmail.com>
@nicklasfrahm
Copy link
ContributorAuthor

I am converting this to a draft until we reach a conclusion in the GitHub issue.

@nicklasfrahmnicklasfrahm marked this pull request as draftNovember 25, 2024 21:56
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@felixfonteinfelixfonteinfelixfontein left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Expose full config via Go API
2 participants
@nicklasfrahm@felixfontein

[8]ページ先頭

©2009-2025 Movatter.jp