Commit 3cf89633e9 is changed how the cobra subcommands are created for storagenode (with prefering local variables instead of package level variables).
However, there is a bug which makes it impossible to restart Storagenode services on Windows: the refactored code creates the rootCmd/runCmd twice: therefore the ctx of the running process is not exactly the same as the ctx which supposed to be stopped / cancelled.
This patch fixes this problem with re-using exising, initialized command instead of creating a new one for cancellation.
Fixes: https://github.com/storj/storj/issues/5845
Change-Id: Ib8a4b80d4574e448f65c8558e927c0908c9c5eed
The cmd/storagenode/main.go is a big mess right now with so many
unneeded config structures initialized and shared by several
subcommands.
There are many instances where the config structure of one subcommand
is mistakenly used for another subcommand.
This changes is an attempt to clean up the main.go by moving the
subcommands to a separate `cmd_*.go` files with separate config structures
for each subcommand.
Resolves https://github.com/storj/storj/issues/5756
Change-Id: I85adf2439acba271c023c269739f7fa3c6d49f9d
func init() code isn't that well defined and reordering of them
could cause problems when starting the whole process from it.
Change-Id: I4088a0db156ece15354877011a481f6f91c9b332