MCPcopy Index your code
hub / github.com/ddev/ddev / CheckCustomConfig

Method CheckCustomConfig

pkg/ddevapp/config_custom.go:48–441  ·  view source on GitHub ↗

CheckCustomConfig checks for custom configuration files and returns a message. If showAll is true, files with #ddev-silent-no-warn marker are included in the output. Returns the message and a bool indicating if warnings were found (true = warnings, false = success).

(showAll bool)

Source from the content-addressed store, hash-verified

46// If showAll is true, files with #ddev-silent-no-warn marker are included in the output.
47// Returns the message and a bool indicating if warnings were found (true = warnings, false = success).
48func (app *DdevApp) CheckCustomConfig(showAll bool) (message string, hasWarnings bool) {
49 ddevDir := filepath.Dir(app.ConfigPath)
50
51 // Define all configuration checks
52 routerEnabled := func() bool { return !slices.Contains(app.OmitContainersGlobal, RouterComposeProjectName) }
53 sshAgentEnabled := func() bool { return !slices.Contains(app.OmitContainersGlobal, SSHAuthName) }
54
55 checks := []customConfigCheck{
56 {
57 collectFiles: func() ([]string, error) {
58 return filepath.Glob(filepath.Join(globalconfig.GetGlobalDdevDir(), "router-compose.*.yaml"))
59 },
60 checkOnlyWhen: routerEnabled,
61 displayName: "Router (global)",
62 },
63 {
64 collectFiles: func() ([]string, error) {
65 return filepath.Glob(filepath.Join(globalconfig.GetGlobalDdevDir(), "ssh-auth-compose.*.yaml"))
66 },
67 checkOnlyWhen: sshAgentEnabled,
68 displayName: "SSH agent (global)",
69 },
70 {
71 collectFiles: func() ([]string, error) {
72 return fileutil.ListFilesWithDepth(filepath.Join(globalconfig.GetGlobalDdevDir(), "commands"), 2)
73 },
74 expectedDdevFiles: func() ([]string, error) {
75 return GetAssetFiles("global_dotddev_assets/commands", filepath.Join(globalconfig.GetGlobalDdevDir(), "commands"))
76 },
77 displayName: "Commands (global)",
78 },
79 {
80 collectFiles: func() ([]string, error) {
81 return fileutil.ListFilesWithDepth(filepath.Join(globalconfig.GetGlobalDdevDir(), "homeadditions"), 2)
82 },
83 expectedDdevFiles: func() ([]string, error) {
84 return GetAssetFiles("global_dotddev_assets/homeadditions", filepath.Join(globalconfig.GetGlobalDdevDir(), "homeadditions"))
85 },
86 displayName: "Home additions (global)",
87 },
88 {
89 collectFiles: func() ([]string, error) {
90 return filepath.Glob(filepath.Join(globalconfig.GetGlobalDdevDir(), "traefik", "static_config.*.yaml"))
91 },
92 checkOnlyWhen: routerEnabled,
93 displayName: "Router (global)",
94 },
95 {
96 collectFiles: func() ([]string, error) {
97 return fileutil.ListFilesInDirFullPath(filepath.Join(globalconfig.GetGlobalDdevDir(), "traefik", "custom-global-config"), true)
98 },
99 expectedDdevFiles: func() ([]string, error) {
100 return GetAssetFiles("global_dotddev_assets/traefik/custom-global-config", filepath.Join(globalconfig.GetGlobalDdevDir(), "traefik", "custom-global-config"))
101 },
102 checkOnlyWhen: routerEnabled,
103 displayName: "Router (global)",
104 },
105 {

Callers 2

StartMethod · 0.95

Calls 12

GetConfigPathMethod · 0.95
IsMutagenEnabledMethod · 0.95
GetXHProfModeMethod · 0.95
GetGlobalDdevDirFunction · 0.92
ListFilesWithDepthFunction · 0.92
ListFilesInDirFullPathFunction · 0.92
WarningOnceFunction · 0.92
GetAssetFilesFunction · 0.85
GatherAllManifestsFunction · 0.85
addPathToAddonMapFunction · 0.85
filterCustomConfigFilesFunction · 0.85
fileLabelFunction · 0.85

Tested by

no test coverage detected