add a flag to generate a network configuration with defaults #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In order to generate a configuration for self-hosted setups we would need to use the any-sync-network CLI in a non interactive manner.
However the CLI is using the survey library for generating the configurations and this library does not support stdin as IO as described in
https://github.com/go-survey/survey#what-kinds-of-io-are-supported-by-survey.
This is a problem for automating the generation of a configuration for creating a docker based setup. We would rather avoid using static keys as in https://github.com/SamBouwer/any-docker because if by any bad luck the local setup is broken and starts to sync data on the public backup node instead of the local one, this could lead to serious troubles for the data, since the keys are public.
To avoid that situation, the cli should rather have a way to generate the configuration with default network values mainly for generating the security keys and leave it to the user to then further update the configurations as necessary. This only works for one node but in the case of self-hosted I think it is good enough for now.
Also, an alternative solution would have been to replace the survey library to use something able to read from stdin but this would be more intrusive and would have more potential for bugs after the change hence my proposal to introduce a simple --defaults flag to the command.
What type of PR is this? (check all applicable)
Related Tickets & Documents
NA
Mobile & Desktop Screenshots/Recordings
NA
Added tests?
Added to documentation?