MCPcopy Create free account
hub / github.com/Scalingo/cli / ExtractDatabaseNameFromCommandLineOrEnv

Function ExtractDatabaseNameFromCommandLineOrEnv

detect/app.go:254–273  ·  view source on GitHub ↗
(c *cli.Command)

Source from the content-addressed store, hash-verified

252}
253
254func ExtractDatabaseNameFromCommandLineOrEnv(c *cli.Command) string {
255 if os.Getenv("SCALINGO_PREVIEW_FEATURES") != "true" {
256 return ""
257 }
258
259 for _, cliContext := range c.Lineage() {
260 dbName := cliContext.String("database")
261 if dbName != "" && dbName != "<database_name>" {
262 return dbName
263 }
264 }
265
266 var dbName string
267
268 if os.Getenv("SCALINGO_DATABASE") != "" {
269 dbName = os.Getenv("SCALINGO_DATABASE")
270 }
271
272 return dbName
273}
274
275// extractAppNameFromGitRemote parses a Git remote and return the app name extracted
276// out of it. The Git remote URL may look like:

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected