Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow predefining targets at startup #16

Merged
merged 8 commits into from
Aug 31, 2021

Conversation

hierynomus
Copy link
Collaborator

No description provided.

- Use of spf13/cobra for command line parsing
- Moved actual proxying code to own package
- Added golangci config
- Upgraded golang version to 1.16

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>
- Split up code over several structs
- Improved cleanup/shutdown logic
- Added flag to start with set of mirrors configured

Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>
Signed-off-by: Jeroen van Erp <jeroen@hierynomus.com>
cmd/root.go Outdated
cmd.Flags().String("password", "", "Provide a file that contains username/password to protect the configuration 'targets' endpoint. Contains 1 username/password combination separated by ':'.")
cmd.Flags().Int("fail-after", 30, "Remove a target when it has been failing for this many minutes.") //nolint:gomnd
cmd.Flags().Int("retry-after", 1, "After 5 successive failures a target is temporarily disabled, it will be retried after this many minutes.")
cmd.Flags().StringSlice("mirror", []string{}, "Mirror traffic to additional targets")
Copy link
Owner

Choose a reason for hiding this comment

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

I prefer to rephrase this to something like "Start with mirroring to these targets"

"github.com/stretchr/testify/assert"
)

func TestReflector(t *testing.T) {
Copy link
Owner

Choose a reason for hiding this comment

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

Nice. A test!

@rb3ckers
Copy link
Owner

Thanks for the refactoring. The code looks a lot cleaner now tbh.

@rb3ckers rb3ckers changed the title Adding persistent targets list Allow predefining targets at startup Aug 30, 2021
@rb3ckers
Copy link
Owner

Note that these pre-configured targets may still disappear from the targets list right now when they are offline for more than the configured time.

@rb3ckers rb3ckers merged commit 2b3ab16 into rb3ckers:master Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants