| 614 | } |
| 615 | |
| 616 | func (t *TomcatContainer) loadConfig() (*tomcatConfig, error) { |
| 617 | tConfig := tomcatConfig{ |
| 618 | Tomcat: Tomcat{ |
| 619 | Version: "", |
| 620 | ExternalConfigurationEnabled: false, |
| 621 | }, |
| 622 | ExternalConfiguration: ExternalConfiguration{ |
| 623 | Version: "", |
| 624 | RepositoryRoot: "", |
| 625 | }, |
| 626 | AccessLoggingSupport: AccessLoggingSupport{ |
| 627 | AccessLogging: "disabled", |
| 628 | }, |
| 629 | } |
| 630 | config := os.Getenv("JBP_CONFIG_TOMCAT") |
| 631 | if config != "" { |
| 632 | yamlHandler := common.YamlHandler{} |
| 633 | // overlay JBP_CONFIG_TOMCAT over default values |
| 634 | if err := yamlHandler.Unmarshal([]byte(config), &tConfig); err != nil { |
| 635 | return nil, fmt.Errorf("failed to parse JBP_CONFIG_TOMCAT: %w", err) |
| 636 | } |
| 637 | } |
| 638 | return &tConfig, nil |
| 639 | } |
| 640 | |
| 641 | type tomcatConfig struct { |
| 642 | Tomcat Tomcat `yaml:"tomcat"` |