@@ -27,24 +27,25 @@ if [[ ! -z "$NIM_TAGS" ]]; then
27
27
PARM=" ${PARM} --tags $NIM_TAGS "
28
28
fi
29
29
30
+ if [[ ! -z " $NIM_TOKEN " ]]; then
31
+ yq -i '
32
+ .server.token=strenv(NIM_TOKEN)
33
+ ' /etc/nginx-agent/nginx-agent.conf
34
+ fi
35
+
30
36
if [[ " $NIM_ADVANCED_METRICS " == " true" ]]; then
31
37
if [ $OLD_AGENT == " false" ]
32
38
then
33
- EXTRA_EXTENSIONS=" - advanced-metrics"
34
-
35
- cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
36
-
37
- # Advanced metrics
38
- advanced_metrics:
39
- socket_path: /var/run/nginx-agent/advanced-metrics.sock
40
- aggregation_period: 1s
41
- publishing_period: 3s
42
- table_sizes_limits:
43
- staging_table_max_size: 1000
44
- staging_table_threshold: 1000
45
- priority_table_max_size: 1000
46
- priority_table_threshold: 1000
47
- __EOT__
39
+ yq -i '
40
+ .advanced_metrics.socket_path="/var/run/nginx-agent/advanced-metrics.sock" |
41
+ .advanced_metrics.aggregation_period="1s" |
42
+ .advanced_metrics.publishing_period="3s" |
43
+ .advanced_metrics.table_sizes_limits.staging_table_max_size=1000 |
44
+ .advanced_metrics.table_sizes_limits.staging_table_threshold=1000 |
45
+ .advanced_metrics.table_sizes_limits.priority_table_max_size=1000 |
46
+ .advanced_metrics.table_sizes_limits.priority_table_threshold= 1000 |
47
+ .extensions += ["advanced-metrics"]
48
+ ' /etc/nginx-agent/nginx-agent.conf
48
49
fi
49
50
fi
50
51
@@ -53,21 +54,15 @@ if [[ "$NAP_WAF" == "true" ]]; then
53
54
then
54
55
PARM=" ${PARM} --nginx-app-protect-report-interval 15s --nap-monitoring-collector-buffer-size 50000 --nap-monitoring-processor-buffer-size 50000 --nap-monitoring-syslog-ip 127.0.0.1 --nap-monitoring-syslog-port 514"
55
56
else
56
- EXTRA_EXTENSIONS=$EXTRA_EXTENSIONS " \n- nginx-app-protect\n- nap-monitoring"
57
-
58
- cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
59
-
60
- # NGINX App Protect Monitoring config
61
- nap_monitoring:
62
- # Buffer size for collector. Will contain log lines and parsed log lines
63
- collector_buffer_size: 50000
64
- # Buffer size for processor. Will contain log lines and parsed log lines
65
- processor_buffer_size: 50000
66
- # Syslog server IP address the collector will be listening to
67
- syslog_ip: "127.0.0.1"
68
- # Syslog server port the collector will be listening to
69
- syslog_port: 514
70
- __EOT__
57
+ export FQDN=127.0.0.1
58
+
59
+ yq -i '
60
+ .nap_monitoring.collector_buffer_size=50000 |
61
+ .nap_monitoring.processor_buffer_size=50000 |
62
+ .nap_monitoring.syslog_ip=strenv(FQDN) |
63
+ .nap_monitoring.syslog_port=514 |
64
+ .extensions += ["nginx-app-protect","nap-monitoring"]
65
+ ' /etc/nginx-agent/nginx-agent.conf
71
66
fi
72
67
73
68
su - nginx -s /bin/bash -c " /opt/app_protect/bin/bd_agent &"
@@ -85,24 +80,12 @@ if [[ "$NAP_WAF_PRECOMPILED_POLICIES" == "true" ]]; then
85
80
then
86
81
PARM=" ${PARM} --nginx-app-protect-precompiled-publication"
87
82
else
88
- cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
89
-
90
- # Enable NGINX App Protect WAF precompiled policies
91
- nginx_app_protect:
92
- precompiled_publication: true
93
- __EOT__
83
+ yq -i '
84
+ .nginx_app_protect.precompiled_publication=true
85
+ ' /etc/nginx-agent/nginx-agent.conf
94
86
fi
95
87
fi
96
88
97
89
fi
98
90
99
- if [[ " $EXTRA_EXTENSIONS " != " " ]]; then
100
- cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
101
-
102
- # Enable extensions
103
- extensions:
104
- ` echo -e $EXTRA_EXTENSIONS | sed " s/^/\ \ /g" `
105
- __EOT__
106
- fi
107
-
108
91
sg nginx-agent " /usr/bin/nginx-agent $PARM "
0 commit comments