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

Function init

cmd/ddev/cmd/config.go:223–335  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

221}
222
223func init() {
224 validAppTypes := strings.Join(ddevapp.GetValidAppTypes(), ", ")
225 projectTypeUsage := fmt.Sprintf("Provide the project type (one of %s). This is autodetected and this flag is necessary only to override the detection.", validAppTypes)
226 projectNameUsage := "Provide the project name of project to configure (normally the same as the last part of directory name)"
227
228 ConfigCommand.Flags().StringVar(&projectNameArg, "project-name", "", projectNameUsage)
229 ConfigCommand.Flags().StringVar(&docrootRelPathArg, "docroot", "", "Provide the relative docroot of the project, like 'docroot' or 'htdocs' or 'web', defaults to empty, the current directory")
230 ConfigCommand.Flags().StringVar(&composerRootRelPathArg, "composer-root", "", "The relative path, from the project root, to the directory containing composer.json (This is where all Composer-related commands are executed.)")
231 ConfigCommand.Flags().BoolVar(&composerRootRelPathDefaultArg, "composer-root-default", false, `Unsets a web service Composer root directory override, the same as --composer-root=""`)
232 ConfigCommand.Flags().StringVar(&projectTypeArg, "project-type", "", projectTypeUsage)
233 _ = ConfigCommand.RegisterFlagCompletionFunc("project-type", configCompletionFunc(ddevapp.GetValidAppTypes()))
234 ConfigCommand.Flags().StringVar(&phpVersionArg, "php-version", nodeps.PHPDefault, "PHP version that will be enabled in the web container")
235 _ = ConfigCommand.RegisterFlagCompletionFunc("php-version", configCompletionFunc(nodeps.GetValidPHPVersions()))
236 ConfigCommand.Flags().StringVar(&routerHTTPPortArg, "router-http-port", nodeps.DdevDefaultRouterHTTPPort, "The router HTTP port for this project")
237 _ = ConfigCommand.RegisterFlagCompletionFunc("router-http-port", configCompletionFunc([]string{nodeps.DdevDefaultRouterHTTPPort}))
238 ConfigCommand.Flags().StringVar(&routerHTTPSPortArg, "router-https-port", nodeps.DdevDefaultRouterHTTPSPort, "The router HTTPS port for this project")
239 _ = ConfigCommand.RegisterFlagCompletionFunc("router-https-port", configCompletionFunc([]string{nodeps.DdevDefaultRouterHTTPSPort}))
240 ConfigCommand.Flags().BoolVar(&xdebugEnabledArg, "xdebug-enabled", false, "Whether Xdebug is enabled in the web container")
241 _ = ConfigCommand.RegisterFlagCompletionFunc("xdebug-enabled", configCompletionFunc([]string{"true", "false"}))
242 ConfigCommand.Flags().BoolVar(&noProjectMountArg, "no-project-mount", false, "Whether to skip mounting project code into the web container")
243 _ = ConfigCommand.RegisterFlagCompletionFunc("no-project-mount", configCompletionFunc([]string{"true", "false"}))
244 ConfigCommand.Flags().StringVar(&additionalHostnamesArg, "additional-hostnames", "", `Comma-delimited list of project hostnames or --additional-hostnames="" to remove any configured additional hostnames`)
245 ConfigCommand.Flags().StringVar(&additionalFQDNsArg, "additional-fqdns", "", `Comma-delimited list of project FQDNs or --additional-fqdns="" to remove any configured FQDNs`)
246 ConfigCommand.Flags().StringVar(&omitContainersArg, "omit-containers", "", "Comma-delimited list of container types that should not be started when the project is started")
247 _ = ConfigCommand.RegisterFlagCompletionFunc("omit-containers", configCompletionFuncWithCommas(nodeps.GetValidOmitContainers()))
248 ConfigCommand.Flags().StringVar(&webEnvironmentLocal, "web-environment", "", `Set the environment variables in the web container: --web-environment="TYPO3_CONTEXT=Development,SOMEENV=someval" or --web-environment="" to remove any previously configured values`)
249 ConfigCommand.Flags().StringVar(&webEnvironmentLocal, "web-environment-add", "", `Append environment variables to the web container: --web-environment-add="TYPO3_CONTEXT=Development,SOMEENV=someval"`)
250 ConfigCommand.Flags().BoolVar(&showConfigLocation, "show-config-location", false, "Output the location of the .ddev/config.yaml file if it exists, or error that it doesn't exist")
251 ConfigCommand.Flags().StringSlice("upload-dirs", []string{}, `Set the project's upload directories, the destination directories of the 'ddev import-files' command, or --upload-dirs="" to remove previously configured values`)
252 ConfigCommand.Flags().StringVar(&webserverTypeArg, "webserver-type", nodeps.WebserverDefault, fmt.Sprintf("Set the project's desired webserver type: %s", strings.Join(nodeps.GetValidWebserverTypes(), "/")))
253 _ = ConfigCommand.RegisterFlagCompletionFunc("webserver-type", configCompletionFunc(nodeps.GetValidWebserverTypes()))
254 ConfigCommand.Flags().StringVar(&webImageArg, "web-image", "", "Set the web container image (for advanced use only)")
255 ConfigCommand.Flags().BoolVar(&webImageDefaultArg, "web-image-default", false, `Sets the default web container image, the same as --web-image=""`)
256 ConfigCommand.Flags().StringVar(&webWorkingDirArg, "web-working-dir", "", "Override the default working directory for the web service")
257 ConfigCommand.Flags().StringVar(&dbWorkingDirArg, "db-working-dir", "", "Override the default working directory for the db service")
258 ConfigCommand.Flags().BoolVar(&webWorkingDirDefaultArg, "web-working-dir-default", false, `Unset a web service working directory override, the same as --web-working-dir=""`)
259 ConfigCommand.Flags().BoolVar(&dbWorkingDirDefaultArg, "db-working-dir-default", false, `Unset a db service working directory override, the same as --db-working-dir=""`)
260 ConfigCommand.Flags().BoolVar(&workingDirDefaultsArg, "working-dir-defaults", false, "Unset all service working directory overrides")
261 ConfigCommand.Flags().String(types.FlagPerformanceModeName, types.FlagPerformanceModeDefault, types.FlagPerformanceModeDescription(types.ConfigTypeProject))
262 _ = ConfigCommand.RegisterFlagCompletionFunc(types.FlagPerformanceModeName, configCompletionFunc(types.ValidPerformanceModeOptions(types.ConfigTypeProject)))
263 ConfigCommand.Flags().Bool(types.FlagPerformanceModeResetName, false, types.FlagPerformanceModeResetDescription(types.ConfigTypeProject))
264
265 ConfigCommand.Flags().String(types.FlagXHProfModeName, types.FlagXHProfModeDefault, types.FlagXHProfModeDescription(types.ConfigTypeProject))
266 _ = ConfigCommand.RegisterFlagCompletionFunc(types.FlagXHProfModeName, configCompletionFunc(types.ValidXHProfModeOptions(types.ConfigTypeProject)))
267 ConfigCommand.Flags().Bool(types.FlagXHProfModeResetName, false, types.FlagXHProfModeResetDescription(types.ConfigTypeProject))
268
269 ConfigCommand.Flags().BoolVar(&failOnHookFail, "fail-on-hook-fail", false, "Decide whether 'ddev start' should be interrupted by a failing hook")
270 _ = ConfigCommand.RegisterFlagCompletionFunc("fail-on-hook-fail", configCompletionFunc([]string{"true", "false"}))
271 ConfigCommand.Flags().StringVar(&hostWebserverPortArg, "host-webserver-port", "", "The web container's localhost-bound HTTP port")
272 ConfigCommand.Flags().StringVar(&hostHTTPSPortArg, "host-https-port", "", "The web container's localhost-bound HTTPS port")
273
274 ConfigCommand.Flags().StringVar(&hostDBPortArg, "host-db-port", "", "The db container's localhost-bound port")
275
276 ConfigCommand.Flags().StringVar(&mailpitHTTPPortArg, "mailpit-http-port", nodeps.DdevDefaultMailpitHTTPPort, "Router HTTP port to be used for Mailpit HTTP access")
277 _ = ConfigCommand.RegisterFlagCompletionFunc("mailpit-http-port", configCompletionFunc([]string{nodeps.DdevDefaultMailpitHTTPPort}))
278
279 ConfigCommand.Flags().StringVar(&mailpitHTTPSPortArg, "mailpit-https-port", nodeps.DdevDefaultMailpitHTTPSPort, "Router port to be used for Mailpit HTTPS access")
280 _ = ConfigCommand.RegisterFlagCompletionFunc("mailpit-https-port", configCompletionFunc([]string{nodeps.DdevDefaultMailpitHTTPSPort}))

Callers

nothing calls this directly

Calls 13

GetValidAppTypesFunction · 0.92
GetValidPHPVersionsFunction · 0.92
GetValidOmitContainersFunction · 0.92
GetValidWebserverTypesFunction · 0.92
ValidXHProfModeOptionsFunction · 0.92
GetValidDatabaseVersionsFunction · 0.92
configCompletionFuncFunction · 0.85

Tested by

no test coverage detected