Skip to content

Add `sg db ...` to create users and resed dbs

Administrator requested to merge sg/hacking-hour-17-dec into main

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:

  1. sg is started from the command line by a user.
  2. sg will detect the absence of the SG_FORCE_CONFIGURATION_MODE environment variable.
  3. sg restarts itself with that variable set to empty (please note that this is not CONFIGURATION_MODE)
  4. the conf package has a special case where it first reads SG_FORCE_CONFIGURATION_MODE before reading CONFIGRURATION_MODE, enabling to leave the latter intact.
  5. sg will start without any warnings from the conf package not finding the frontend because it is now running with empty as its configuration mode.
  6. When running sub-commands, the makeEnv function will trim the SG_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 :)

Merge request reports

Loading