Add `sg db ...` to create users and resed dbs
Created by: jhchabran
The original PR #29201 has been reviewed and merged, but it came with a side-effect that introduced multiple warning messages that would have been confusing for the users. So we reverted the PR.
This PR re-enable this set of commands but also comes with the fix to avoid.
It works likes this:
-
sgis started from the command line by a user. -
sgwill detect the absence of theSG_FORCE_CONFIGURATION_MODEenvironment variable. -
sgrestarts itself with that variable set toempty(please note that this is notCONFIGURATION_MODE) - the
confpackage has a special case where it first readsSG_FORCE_CONFIGURATION_MODEbefore readingCONFIGRURATION_MODE, enabling to leave the latter intact. -
sgwill start without any warnings from theconfpackage not finding the frontend because it is now running withemptyas its configuration mode. - When running sub-commands, the
makeEnvfunction will trim theSG_FORCE_CONFIGURATION_MODEfrom the environment, enabling them to behave normally regarding the configuration mode.
See the related root cause and its associated ticket: https://github.com/sourcegraph/sourcegraph/issues/29222.
I have highlighted the new code that needs to be reviewed :)