Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OSS bits for supporting specifying the enterprise license via config #10210

Merged
merged 1 commit into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/10210.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
licensing: **(Enterprise Only)** Consul Enterprise has gained the ability to autoload a license via configuration. This can be specified with the `license_path` configuration, the `CONSUL_LICENSE` environment variable or the `CONSUL_LICENSE_PATH` environment variable
```
4 changes: 4 additions & 0 deletions agent/config/builder_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func validateEnterpriseConfigKeys(config *Config) []error {
if boolVal(config.Audit.Enabled) || len(config.Audit.Sinks) > 0 {
add("audit")
}
if config.LicensePath != nil {
add("license_path")
config.LicensePath = nil
}

return result
}
Expand Down
9 changes: 9 additions & 0 deletions agent/config/builder_oss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ func TestValidateEnterpriseConfigKeys(t *testing.T) {
require.Nil(t, c.ACL.Tokens.ManagedServiceProvider)
},
},
"license_path": {
config: Config{
LicensePath: &stringVal,
},
badKeys: []string{"license_path"},
check: func(t *testing.T, c *Config) {
require.Empty(t, c.LicensePath)
},
},
"multi": {
config: Config{
ReadReplica: &boolVal,
Expand Down
1 change: 1 addition & 0 deletions agent/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ type Config struct {
HTTPConfig HTTPConfig `mapstructure:"http_config"`
KeyFile *string `mapstructure:"key_file"`
LeaveOnTerm *bool `mapstructure:"leave_on_terminate"`
LicensePath *string `mapstructure:"license_path"`
Limits Limits `mapstructure:"limits"`
LogLevel *string `mapstructure:"log_level"`
LogJSON *bool `mapstructure:"log_json"`
Expand Down
1 change: 1 addition & 0 deletions agent/config/runtime_oss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ func entFullRuntimeConfig(rt *RuntimeConfig) {}
var enterpriseReadReplicaWarnings = []string{enterpriseConfigKeyError{key: "read_replica (or the deprecated non_voting_server)"}.Error()}

var enterpriseConfigKeyWarnings = []string{
enterpriseConfigKeyError{key: "license_path"}.Error(),
enterpriseConfigKeyError{key: "read_replica (or the deprecated non_voting_server)"}.Error(),
enterpriseConfigKeyError{key: "autopilot.redundancy_zone_tag"}.Error(),
enterpriseConfigKeyError{key: "autopilot.upgrade_version_tag"}.Error(),
Expand Down
1 change: 1 addition & 0 deletions agent/config/testdata/full-config.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ http_config {
}
key_file = "IEkkwgIA"
leave_on_terminate = true
license_path = "/path/to/license.lic"
limits {
http_max_conns_per_client = 100
https_handshake_timeout = "2391ms"
Expand Down
1 change: 1 addition & 0 deletions agent/config/testdata/full-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
},
"key_file": "IEkkwgIA",
"leave_on_terminate": true,
"license_path": "/path/to/license.lic",
"limits": {
"http_max_conns_per_client": 100,
"https_handshake_timeout": "2391ms",
Expand Down