@@ -17,40 +17,46 @@ import (
1717const defaultInstallConfigPath = "/etc/ols-cli/install.json"
1818
1919type RuntimeInstallConfig struct {
20- PHPVersion string `json:"php_version"`
21- DatabaseEngine string `json:"database"`
22- ConfigureListeners * bool `json:"configure_listeners,omitempty"`
23- HTTPPort int `json:"http_port"`
24- HTTPSPort int `json:"https_port"`
25- SSLCertFile string `json:"ssl_cert_file"`
26- SSLKeyFile string `json:"ssl_key_file"`
27- OWASPCRSVersion string `json:"owasp_crs_version"`
20+ PHPVersion string `json:"php_version"`
21+ DatabaseEngine string `json:"database"`
22+ ConfigureListeners * bool `json:"configure_listeners,omitempty"`
23+ HTTPPort int `json:"http_port"`
24+ HTTPSPort int `json:"https_port"`
25+ SSLCertFile string `json:"ssl_cert_file"`
26+ SSLKeyFile string `json:"ssl_key_file"`
27+ OWASPCRSVersion string `json:"owasp_crs_version"`
28+ VHRecaptchaType int `json:"vh_recaptcha_type"`
29+ VHRecaptchaReqLimit int `json:"vh_recaptcha_reg_conn_limit"`
2830}
2931
3032type resolvedInstallPlan struct {
31- ConfigPath string
32- PHPVersion string
33- DatabaseEngine string
34- DatabasePackage string
35- ConfigureListeners bool
36- HTTPPort int
37- HTTPSPort int
38- SSLCertFile string
39- SSLKeyFile string
40- OWASPCRSVersion string
33+ ConfigPath string
34+ PHPVersion string
35+ DatabaseEngine string
36+ DatabasePackage string
37+ ConfigureListeners bool
38+ HTTPPort int
39+ HTTPSPort int
40+ SSLCertFile string
41+ SSLKeyFile string
42+ OWASPCRSVersion string
43+ VHRecaptchaType int
44+ VHRecaptchaReqLimit int
4145}
4246
4347func defaultRuntimeInstallConfig (lswsRoot string ) RuntimeInstallConfig {
4448 enabled := true
4549 return RuntimeInstallConfig {
46- PHPVersion : "85" ,
47- DatabaseEngine : "mariadb" ,
48- ConfigureListeners : & enabled ,
49- HTTPPort : 80 ,
50- HTTPSPort : 443 ,
51- SSLCertFile : filepath .Join (lswsRoot , "admin" , "conf" , "webadmin.crt" ),
52- SSLKeyFile : filepath .Join (lswsRoot , "admin" , "conf" , "webadmin.key" ),
53- OWASPCRSVersion : defaultOWASPCRSVersion ,
50+ PHPVersion : "85" ,
51+ DatabaseEngine : "mariadb" ,
52+ ConfigureListeners : & enabled ,
53+ HTTPPort : 80 ,
54+ HTTPSPort : 443 ,
55+ SSLCertFile : filepath .Join (lswsRoot , "admin" , "conf" , "webadmin.crt" ),
56+ SSLKeyFile : filepath .Join (lswsRoot , "admin" , "conf" , "webadmin.key" ),
57+ OWASPCRSVersion : defaultOWASPCRSVersion ,
58+ VHRecaptchaType : defaultVHRecaptchaType ,
59+ VHRecaptchaReqLimit : defaultVHRecaptchaReqLimit ,
5460 }
5561}
5662
@@ -112,6 +118,12 @@ func mergeRuntimeInstallConfig(base, override RuntimeInstallConfig) RuntimeInsta
112118 if v := strings .TrimSpace (override .OWASPCRSVersion ); v != "" {
113119 base .OWASPCRSVersion = v
114120 }
121+ if override .VHRecaptchaType > 0 {
122+ base .VHRecaptchaType = override .VHRecaptchaType
123+ }
124+ if override .VHRecaptchaReqLimit > 0 {
125+ base .VHRecaptchaReqLimit = override .VHRecaptchaReqLimit
126+ }
115127 return base
116128}
117129
@@ -172,6 +184,14 @@ func resolveInstallPlan(opts InstallOptions, info platform.Info, lswsRoot string
172184 if owaspCRSVersion == "" {
173185 owaspCRSVersion = defaultOWASPCRSVersion
174186 }
187+ vhRecaptchaType := cfg .VHRecaptchaType
188+ if vhRecaptchaType <= 0 {
189+ vhRecaptchaType = defaultVHRecaptchaType
190+ }
191+ vhRecaptchaReqLimit := cfg .VHRecaptchaReqLimit
192+ if vhRecaptchaReqLimit <= 0 {
193+ vhRecaptchaReqLimit = defaultVHRecaptchaReqLimit
194+ }
175195
176196 if err := validatePort (httpPort , "http_port" ); err != nil {
177197 return resolvedInstallPlan {}, err
@@ -195,16 +215,18 @@ func resolveInstallPlan(opts InstallOptions, info platform.Info, lswsRoot string
195215 }
196216
197217 return resolvedInstallPlan {
198- ConfigPath : cfgPath ,
199- PHPVersion : phpVersion ,
200- DatabaseEngine : dbEngine ,
201- DatabasePackage : dbPackage ,
202- ConfigureListeners : configureListeners ,
203- HTTPPort : httpPort ,
204- HTTPSPort : httpsPort ,
205- SSLCertFile : sslCertFile ,
206- SSLKeyFile : sslKeyFile ,
207- OWASPCRSVersion : owaspCRSVersion ,
218+ ConfigPath : cfgPath ,
219+ PHPVersion : phpVersion ,
220+ DatabaseEngine : dbEngine ,
221+ DatabasePackage : dbPackage ,
222+ ConfigureListeners : configureListeners ,
223+ HTTPPort : httpPort ,
224+ HTTPSPort : httpsPort ,
225+ SSLCertFile : sslCertFile ,
226+ SSLKeyFile : sslKeyFile ,
227+ OWASPCRSVersion : owaspCRSVersion ,
228+ VHRecaptchaType : vhRecaptchaType ,
229+ VHRecaptchaReqLimit : vhRecaptchaReqLimit ,
208230 }, nil
209231}
210232
0 commit comments