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

normaliseconf flag removes existing values #1134

Open
tbitcomb opened this issue Mar 24, 2024 · 2 comments
Open

normaliseconf flag removes existing values #1134

tbitcomb opened this issue Mar 24, 2024 · 2 comments

Comments

@tbitcomb
Copy link

tbitcomb commented Mar 24, 2024

The behavior of -normaliseconf seems to have changed between v4 and v5.

I used to be able to have a generic config that I could then use that argument on to generate a key for while leaving everything in tact:

cat yggdrasil.conf | yggdrasil -useconf -normaliseconf > yggdrasil.conf

For instance, if I have a sort of "template" config with peers and node info set up, but without a private key, the above used to add the key but leave the rest alone.

After I upgraded to 0.5.5, it now adds the key but erases my defaults, replacing them with empty lists and such. This is true even with a config that was initially generated by v0.5.5.

EDIT: This might specifically involve the version available for Alpine Linux, as this does not seem to be a problem on macOS.

@neilalexander
Copy link
Member

Does this happen if you do yggdrasil -useconffile yggdrasil.conf -normaliseconf > yggdrasil.conf instead?

@klemensn
Copy link
Contributor

klemensn commented Oct 5, 2024

Does this happen if you do yggdrasil -useconffile yggdrasil.conf -normaliseconf > yggdrasil.conf instead?

Your shell will truncate the file before yggdrasil reads it.
This does not do what you think it does.

$ echo garbage >| yggdrasil.conf
$ yggdrasil -useconffile yggdrasil.conf -normaliseconf          
panic: json: cannot unmarshal string into Go value of type config.NodeConfig

goroutine 1 [running]:
main.main()
	github.com/yggdrasil-network/yggdrasil-go/cmd/yggdrasil/main.go:114 +0x23da
$ yggdrasil -useconffile yggdrasil.conf -normaliseconf >| yggdrasil.conf
$ echo $?
0

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

No branches or pull requests

3 participants