MCPcopy Create free account
hub / github.com/ddev/ddev / enableDotEnvLoading

Function enableDotEnvLoading

pkg/ddevapp/cakephp.go:86–96  ·  view source on GitHub ↗
(app *DdevApp)

Source from the content-addressed store, hash-verified

84}
85
86func enableDotEnvLoading(app *DdevApp) error {
87 bootstrapFileName := "config/bootstrap.php"
88 bootstrapFilePath := filepath.Join(app.AppRoot, app.ComposerRoot, bootstrapFileName)
89 envFunction := "// if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {\n// $dotenv = new \\josegonzalez\\Dotenv\\Loader([CONFIG . '.env']);\n// $dotenv->parse()\n// ->putenv()\n// ->toEnv()\n// ->toServer();\n// }\n"
90 err := fileutil.ReplaceStringInFile(envFunction, strings.ReplaceAll(envFunction, "// ", ""), bootstrapFilePath, bootstrapFilePath)
91 if err != nil {
92 return err
93 }
94
95 return nil
96}

Callers 1

cakephpPostStartActionFunction · 0.85

Calls 1

ReplaceStringInFileFunction · 0.92

Tested by

no test coverage detected