anyproto / any-sync-tools

Configuration builder for Any-Sync nodes
https://anytype.io
MIT License
15 stars 9 forks source link

add a flag to generate a network configuration with defaults #7

Open clems4ever opened 1 year ago

clems4ever commented 1 year ago

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?