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

replicate ignores -config flag when database is specified #85

Closed
mtlynch opened this issue Feb 26, 2021 · 2 comments · Fixed by #94
Closed

replicate ignores -config flag when database is specified #85

mtlynch opened this issue Feb 26, 2021 · 2 comments · Fixed by #94
Labels
bug Something isn't working
Milestone

Comments

@mtlynch
Copy link
Contributor

mtlynch commented Feb 26, 2021

Example command

litestream replicate -config /home/mike/litestream.yml "${PWD}/data/store.db" s3://scratch.tinypilotkvm.com/db

For the command above, litestream silently ignores the -config flag, which caught me by surprise. The issue seems to be here:

https://github.com/benbjohnson/litestream/blob/f652186adf7470256b6a7bf7e96194dde49c2af2/cmd/litestream/replicate.go#L43L61

It only reads the config flag if it's the only argument, like:

litestream replicate -config /home/mike/litestream.yml

Desired behavior

If I've specified a -config file but litestream is not using it, I'd like litestream to error out or print a warning.

It'd also be handy if litestream allowed me to specify a db, and then if there's only one replica URL in my config file, it just uses that one, so I could say:

litestream replicate -config /home/mike/litestream.yml "${PWD}/data/store.db"

And then if my config file had an entry for store.db, litestream just picks the first replica URL.

@benbjohnson benbjohnson added this to the v0.3.3 milestone Feb 27, 2021
@benbjohnson benbjohnson added the bug Something isn't working label Feb 27, 2021
@benbjohnson
Copy link
Owner

Yeah, that is not a great behavior. I'll have it error out if a config is specified but not used.

I'm a little hesitant about overloading the CLI args. Right now I see two use cases—one where someone is new to Litestream and just wants to try it out with a DB & replica URL and another where someone sets up a config and runs in production.

@benbjohnson
Copy link
Owner

This issue is fixed with #94. I added tests for all the commands in a runbook to verify they all work correctly. I can reopen the issue if you have any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants