modulesFromCSV creates ModulesConfig from a comma-separated list of enabled types. Types not in the list are disabled.
(csv string)
| 242 | // modulesFromCSV creates ModulesConfig from a comma-separated list of enabled types. |
| 243 | // Types not in the list are disabled. |
| 244 | func modulesFromCSV(csv string) ModulesConfig { |
| 245 | enabled := make(map[string]bool) |
| 246 | for _, t := range strings.Split(csv, ",") { |
| 247 | enabled[strings.TrimSpace(t)] = true |
| 248 | } |
| 249 | |
| 250 | t, f := true, false |
| 251 | return ModulesConfig{ |
| 252 | Sentry: boolPtr(enabled["sentry"], t, f), |
| 253 | Ray: boolPtr(enabled["ray"], t, f), |
| 254 | VarDump: boolPtr(enabled["var-dump"], t, f), |
| 255 | Inspector: boolPtr(enabled["inspector"], t, f), |
| 256 | Monolog: boolPtr(enabled["monolog"], t, f), |
| 257 | SMTP: boolPtr(enabled["smtp"], t, f), |
| 258 | SMS: boolPtr(enabled["sms"], t, f), |
| 259 | HttpDump: boolPtr(enabled["http-dump"], t, f), |
| 260 | Profiler: boolPtr(enabled["profiler"], t, f), |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | func boolPtr(cond bool, yes, no bool) *bool { |
| 265 | if cond { |