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
Configuration system for knoxite #120
Conversation
return fmt.Errorf("set needs to know which option to set") | ||
} | ||
if len(args) < 2 { | ||
return fmt.Errorf("set needs to know which value to 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.
This may be the wrong position to critizise this here, since we're doing this in every command - but shouldn't we just print the help text of this command reather than a specific help text? I often had the situation where i typed just the second argument of a command requiring two arguments and was confused when reading that the second argument was missing
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.
Yeah, let's keep this discussion in a separate issue / ticket.
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.
Awesome-sauce. Just a few changes required!
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.
After the requested changes, this looks good to me! Great contribution! <3
- Move CompressionTypeFromString() to utils.go - Move CompressionText to utils.go - Also move ErrCompressionUnkown to utils.go
- Move EncryptionTypeFromString to utils.go - Move EncryptionText to utils.go - Move ErrEncryptionUnkown to utils.go
f188205
to
21a686f
Compare
Applied the changes as requested and splitted up the commits a bit more.
|
- move readPassword and readPasswordTwice to utils.go - moved ErrPasswordMismatch to utils.go
This commits adds a configuration system backend to knoxite. The code is heavily inspired by the configuration backend for beehive written by rubiojr so all your credits are belong to him: muesli/beehive@5f810ab The main difference is ofc the adjustments to work with/for knoxite. I also modified the password system as I'm not feeling safe setting the password for the config file in an environment variable. It'll prompt the user once when there's no password specified in the url.
Our main.go file will now initialize a cfg.Config object for us. This object can be used to in further commands to read out the corresponding values. The path to the configfile can be specified via an URL. For example to use an aes encrypted configuration file you can pass an url like this: ./knoxite config init --ConfigURL "crypto:///path/to/config.conf" You can also pass you encryption password via the url: ./knoxite config init --ConfigURL "crypto://password@/path/to/config.conf" Also updated dependencies
The config command can be used to manage and tweak the configuration
This subcommand helps to set specific values in the configuration file
These commands will output the config to stdout
With the config alias command you can declare shorthands for your repository configurations.
This will implement and use the values specified in the configuration file and provided by the configuration system for store command in knoxite
This will implement and use the values specified in the configuration file and provided by the configuration system for the clone command in knoxite
This will implement and use the values specified in the configuration file for the repopath(s) and provided by the configuration system for the repository command in knoxite
The first check for the redundancy amount should be checked as int. After that convert the tolerance-value to uiunt for further use in snapshot.Add
This PR adds the first draft for a configuration which support multiple config file backend system in knoxite. This brings support for multiple config file backends to make it easier to implement other backends (encrypted, networked, etc). Fixes #72
The knoxite commands will respect the values stored in the config but you're still able to overwrite them via command line flags. You can specify which configuration configbackend you want to use and the path to the file with the new
-C | --configURL
flag .To create a new shorthand for an repository configuration with the new
repo alias
command:You can use the new subcommand
config
to manage your configuration:For example with the
set
command you can tweak configuration values: