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

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

clems4ever
Copy link
Contributor

@clems4ever clems4ever commented Aug 4, 2023

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)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI

Related Tickets & Documents

NA

Mobile & Desktop Screenshots/Recordings

NA

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📓 tech-docs
  • 🙅 no documentation needed

the cli for generating network configurations is using the survey
library for generating the configurations. However, 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 configuration for
creating a docker based setup. We would rather not use static keys as
done 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.
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.

1 participant