MCPcopy Index your code
hub / github.com/cloudfoundry/java-buildpack / loadConfig

Method loadConfig

src/java/frameworks/debug.go:128–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126}
127
128func (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
151func contains(s, substr string) bool {

Callers 3

DetectMethod · 0.95
SupplyMethod · 0.95
FinalizeMethod · 0.95

Calls 2

ValidateFieldsMethod · 0.95
UnmarshalMethod · 0.95

Tested by

no test coverage detected