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:
-
sg
is started from the command line by a user. -
sg
will detect the absence of theSG_FORCE_CONFIGURATION_MODE
environment variable. -
sg
restarts itself with that variable set toempty
(please note that this is notCONFIGURATION_MODE
) - the
conf
package has a special case where it first readsSG_FORCE_CONFIGURATION_MODE
before readingCONFIGRURATION_MODE
, enabling to leave the latter intact. -
sg
will start without any warnings from theconf
package not finding the frontend because it is now running withempty
as its configuration mode. - When running sub-commands, the
makeEnv
function will trim theSG_FORCE_CONFIGURATION_MODE
from 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 :)