Skip to content

Commit 1349eb6

Browse files
committed
refactor: simplify custom Kibana config to auto-detect file
- Remove configKibanaCustomConfigEnabled option - Automatically detect kibana-custom.yml file existence - Simplify setup - just create the file to enable custom config - Update documentation to reflect simpler approach - Maintain backward compatibility and all existing functionality This makes the feature more discoverable and easier to use without requiring users to enable it via configuration.
1 parent 81d1441 commit 1349eb6

File tree

5 files changed

+19
-31
lines changed

5 files changed

+19
-31
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,13 @@ The following settings are available per profile:
689689
* `stack.elastic_subscription` allows to select the Elastic subscription type to be used in the stack.
690690
Currently, it is supported "basic" and "[trial](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-trial.html)",
691691
which enables all subscription features for 30 days. Defaults to "trial".
692-
* `stack.kibana_custom_config_enabled` can be set to true to enable custom Kibana configuration.
693-
When enabled, you can create a `kibana-custom.yml` file in your profile directory with additional
694-
Kibana settings that will be appended to the base configuration. Defaults to false.
695-
See [Custom Kibana Configuration](docs/howto/custom_kibana_config.md) for details.
692+
693+
## Custom Kibana Configuration
694+
695+
You can provide custom Kibana configuration by creating a `kibana-custom.yml` file in your profile directory.
696+
The custom configuration will be automatically appended to the base configuration when the file exists.
697+
698+
See [Custom Kibana Configuration](docs/howto/custom_kibana_config.md) for detailed instructions.
696699

697700
## Useful environment variables
698701

docs/howto/custom_kibana_config.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,13 @@ You can provide additional Kibana configuration that will be appended to the bas
1313

1414
## Setup
1515

16-
1. Enable custom configuration in your profile:
17-
```bash
18-
# Edit ~/.elastic-package/profiles/default/config.yml
19-
stack.kibana_custom_config_enabled: true
20-
```
21-
22-
2. Create your custom configuration file:
16+
1. Create your custom configuration file:
2317
```bash
2418
# Create ~/.elastic-package/profiles/default/kibana-custom.yml
2519
touch ~/.elastic-package/profiles/default/kibana-custom.yml
2620
```
2721

28-
3. Add your custom configuration:
22+
2. Add your custom configuration:
2923
```yaml
3024
# Example custom configuration
3125
logging.loggers:
@@ -142,9 +136,9 @@ monitoring.ui.container.elasticsearch.enabled: true
142136
## Troubleshooting
143137

144138
### Configuration Not Applied
145-
- Ensure `stack.kibana_custom_config_enabled: true` is set in your profile's `config.yml`
146139
- Verify the `kibana-custom.yml` file exists in your profile directory
147140
- Check that the YAML syntax is valid
141+
- Ensure the file is in the correct location: `~/.elastic-package/profiles/{profile_name}/kibana-custom.yml`
148142

149143
### Template Errors
150144
- Use `{{ fact "variable_name" }}` syntax for template variables
@@ -168,7 +162,7 @@ You can have different custom configurations for different profiles:
168162
~/.elastic-package/profiles/production/kibana-custom.yml
169163
```
170164

171-
Each profile can enable or disable custom configuration independently.
165+
Custom configuration is automatically detected and applied for each profile when the `kibana-custom.yml` file exists.
172166

173167
## Best Practices
174168

internal/profile/_static/config.yml.example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,3 @@
2929

3030
## Set license subscription
3131
# stack.elastic_subscription: "basic"
32-
33-
## Custom Kibana Configuration
34-
# Enable custom kibana.yml configuration file
35-
# stack.kibana_custom_config_enabled: true

internal/stack/kibana_config.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ func kibanaConfigWithCustomContent(profile *profile.Profile) func(resource.Conte
3333
return fmt.Errorf("failed to write base kibana config: %w", err)
3434
}
3535

36-
// Check if custom config is enabled and exists
37-
if profile.Config(configKibanaCustomConfigEnabled, "false") == "false" {
38-
return nil // No custom config needed
39-
}
40-
36+
// Check if custom config file exists
4137
customConfigPath := profile.Path(KibanaCustomConfigFile)
4238
customConfigData, err := os.ReadFile(customConfigPath)
4339
if os.IsNotExist(err) {

internal/stack/resources.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ const (
6161
elasticsearchUsername = "elastic"
6262
elasticsearchPassword = "changeme"
6363

64-
configAPMEnabled = "stack.apm_enabled"
65-
configGeoIPDir = "stack.geoip_dir"
66-
configKibanaHTTP2Enabled = "stack.kibana_http2_enabled"
67-
configKibanaCustomConfigEnabled = "stack.kibana_custom_config_enabled"
68-
configLogsDBEnabled = "stack.logsdb_enabled"
69-
configLogstashEnabled = "stack.logstash_enabled"
70-
configSelfMonitorEnabled = "stack.self_monitor_enabled"
71-
configElasticSubscription = "stack.elastic_subscription"
64+
configAPMEnabled = "stack.apm_enabled"
65+
configGeoIPDir = "stack.geoip_dir"
66+
configKibanaHTTP2Enabled = "stack.kibana_http2_enabled"
67+
configLogsDBEnabled = "stack.logsdb_enabled"
68+
configLogstashEnabled = "stack.logstash_enabled"
69+
configSelfMonitorEnabled = "stack.self_monitor_enabled"
70+
configElasticSubscription = "stack.elastic_subscription"
7271
)
7372

7473
var (

0 commit comments

Comments
 (0)