Skip to content

Commit e2f86b1

Browse files
committed
Address feedback
1 parent 5cd3241 commit e2f86b1

File tree

11 files changed

+34
-22
lines changed

11 files changed

+34
-22
lines changed

src/core/config/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ func getNginx() Nginx {
354354
NginxClientVersion: Viper.GetInt(NginxClientVersion),
355355
ConfigReloadMonitoringPeriod: Viper.GetDuration(NginxConfigReloadMonitoringPeriod),
356356
TreatWarningsAsErrors: Viper.GetBool(NginxTreatWarningsAsErrors),
357-
Ca: Viper.GetString(NginxCa),
357+
ApiTls: TLSConfig{
358+
Ca: Viper.GetString(NginxApiTlsCa),
359+
},
358360
}
359361
}
360362

src/core/config/defaults.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ var (
6666
NginxClientVersion: 7, // NGINX Plus R25+
6767
ConfigReloadMonitoringPeriod: 10 * time.Second,
6868
TreatWarningsAsErrors: false,
69-
Ca: "",
69+
ApiTls: TLSConfig{
70+
Ca: "",
71+
},
7072
},
7173
ConfigDirs: "/etc/nginx:/usr/local/etc/nginx:/usr/share/nginx/modules:/etc/nms",
7274
IgnoreDirectives: []string{},
@@ -176,7 +178,7 @@ const (
176178
NginxClientVersion = NginxKey + agent_config.KeyDelimiter + "client_version"
177179
NginxConfigReloadMonitoringPeriod = NginxKey + agent_config.KeyDelimiter + "config_reload_monitoring_period"
178180
NginxTreatWarningsAsErrors = NginxKey + agent_config.KeyDelimiter + "treat_warnings_as_errors"
179-
NginxCa = NginxKey + agent_config.KeyDelimiter + "ca"
181+
NginxApiTlsCa = NginxKey + agent_config.KeyDelimiter + "api_tls_ca"
180182

181183
// viper keys used in config
182184
DataplaneKey = "dataplane"
@@ -324,9 +326,9 @@ var (
324326
DefaultValue: Defaults.Nginx.TreatWarningsAsErrors,
325327
},
326328
&StringFlag{
327-
Name: NginxCa,
329+
Name: NginxApiTlsCa,
328330
Usage: "The NGINX Plus CA certificate file location needed to call the NGINX Plus API if SSL is enabled.",
329-
DefaultValue: Defaults.Nginx.Ca,
331+
DefaultValue: Defaults.Nginx.ApiTls.Ca,
330332
},
331333
// Metrics
332334
&DurationFlag{

src/core/config/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ type Nginx struct {
155155
NginxClientVersion int `mapstructure:"client_version" yaml:"-"`
156156
ConfigReloadMonitoringPeriod time.Duration `mapstructure:"config_reload_monitoring_period" yaml:"-"`
157157
TreatWarningsAsErrors bool `mapstructure:"treat_warnings_as_errors" yaml:"-"`
158-
Ca string `mapstructure:"ca" yaml:"-"`
158+
ApiTls TLSConfig `mapstructure:"api_tls" yaml:"-"`
159159
}
160160

161161
type Dataplane struct {

src/core/metrics/sources/nginx_plus.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ func NewNginxPlus(baseDimensions *metrics.CommonDim, nginxNamespace, plusNamespa
8787

8888
client := http.DefaultClient
8989

90-
if conf.Nginx.Ca != "" && conf.IsFileAllowed(conf.Nginx.Ca) {
91-
data, err := os.ReadFile(conf.Nginx.Ca)
90+
if conf.Nginx.ApiTls.Ca != "" && conf.IsFileAllowed(conf.Nginx.ApiTls.Ca) {
91+
data, err := os.ReadFile(conf.Nginx.ApiTls.Ca)
9292
if err != nil {
9393
log.Errorf("Unable to collect NGINX Plus metrics. Failed to read NGINX CA certificate file: %v", err)
9494
return nil

test/integration/vendor/github.com/nginx/agent/v2/src/core/config/config.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/integration/vendor/github.com/nginx/agent/v2/src/core/config/defaults.go

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/integration/vendor/github.com/nginx/agent/v2/src/core/config/types.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/performance/vendor/github.com/nginx/agent/v2/src/core/config/config.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/performance/vendor/github.com/nginx/agent/v2/src/core/config/defaults.go

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/performance/vendor/github.com/nginx/agent/v2/src/core/config/types.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)