INNER CODE UNIT · Go

parseConfig

openrundev/openrun · cmd/openrun/main.go:169

func parseConfig(cCtx *cli.Context, globalConfig *types.GlobalConfig, clientConfig *types.ClientConfig, serverConfig *types.ServerConfig) error {
	// Find OPENRUN_HOME and config file, update OPENRUN_HOME in env
	clHome, filePath, clHomeEnvSet, homeDefaulted, err := getConfigPath(cCtx)
	if err != nil {
		return err
	}
	clHome, err = filepath.Abs(clHome)
	if err != nil {
		return fmt.Errorf("unable to resolve OPENRUN_HOME: %w", err)
	}
	os.Setenv(types.OPENRUN_HOME, clHome) //nolint:errcheck

	if homeDefaulted && !system.FileExists(filePath) {
		if system.IsRunningAsService() {
			// The default home resolves to the service account profile (e.g.
			// C:\Windows\System32\config\systemprofile), not the installing
			// user's home, and a bootstrapped admin password would be printed
			// where nobody can see it. Fail fast instead of silently creating

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…