-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a flag to generate a network configuration with defaults
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.
- Loading branch information
1 parent
15ddf55
commit 82b5a0b
Showing
4 changed files
with
138 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
on: | ||
push: [] | ||
|
||
name: build_and_test | ||
|
||
jobs: | ||
build: | ||
name: build release | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
arch: | ||
- amd64 | ||
- arm64 | ||
os: | ||
- linux | ||
- windows | ||
- darwin | ||
go-version: | ||
- 1.19.5 | ||
include: | ||
- arch: amd64 | ||
rpm_arch: x86_64 | ||
- arch: arm64 | ||
rpm_arch: aarch64 | ||
env: | ||
GOPRIVATE: github.com/anyproto | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '${{ matrix.go-version }}' | ||
- name: git config | ||
run: git config --global url.https://${{ secrets.ANYTYPE_PAT }}@github.com/.insteadOf https://github.com/ | ||
# cache {{ | ||
- id: go-cache-paths | ||
run: | | ||
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT | ||
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ steps.go-cache-paths.outputs.GOCACHE }} | ||
${{ steps.go-cache-paths.outputs.GOMODCACHE }} | ||
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ matrix.go-version }}-${{ matrix.os }}-${{ matrix.arch }}- | ||
# }} | ||
|
||
# build {{ | ||
- name: deps | ||
run: make deps | ||
|
||
#- name: unit tests | ||
# run: make test | ||
- name: test default config generation | ||
run: go run any-sync-network/main.go create --defaults | ||
|
||
- name: build | ||
run: make build BUILD_GOOS=${{ matrix.os}} BUILD_GOARCH=${{ matrix.arch }} | ||
# }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters