()
| 126 | } |
| 127 | |
| 128 | func (d *DebugFramework) loadConfig() (*debugConfig, error) { |
| 129 | // initialize default values |
| 130 | dbgConfig := debugConfig{ |
| 131 | Enabled: false, |
| 132 | Port: 8000, |
| 133 | Suspend: false, |
| 134 | } |
| 135 | config := os.Getenv("JBP_CONFIG_DEBUG") |
| 136 | if config != "" { |
| 137 | yamlHandler := common.YamlHandler{} |
| 138 | err := yamlHandler.ValidateFields([]byte(config), &dbgConfig) |
| 139 | if err != nil { |
| 140 | d.context.Log.Warning("Unknown user config values: %s", err.Error()) |
| 141 | } |
| 142 | // overlay JBP_CONFIG_DEBUG over default values |
| 143 | if err = yamlHandler.Unmarshal([]byte(config), &dbgConfig); err != nil { |
| 144 | return nil, fmt.Errorf("failed to parse JBP_CONFIG_DEBUG: %w", err) |
| 145 | } |
| 146 | } |
| 147 | return &dbgConfig, nil |
| 148 | } |
| 149 | |
| 150 | // Helper function to check if string contains substring |
| 151 | func contains(s, substr string) bool { |
no test coverage detected