@@ -23,6 +23,8 @@ server_name = "example.com"
2323
2424redirect_http = true
2525
26+ logging_enabled = false
27+
2628ssl_certificate = "/tmp/full.pem"
2729ssl_certificate_key = "/tmp/key.pem"
2830letsencrypt = true
@@ -52,6 +54,9 @@ dest = "google"`)
5254 if ! cfg .LetsEncrypt {
5355 t .Error ("expected letsencrypt true" )
5456 }
57+ if cfg .LoggingEnabled {
58+ t .Error ("expected logging_enabled false" )
59+ }
5560 if cfg .ServerName != "example.com" {
5661 t .Errorf ("expected server name example.com, got %s" , cfg .ServerName )
5762 }
@@ -65,10 +70,11 @@ dest = "google"`)
6570
6671func TestGenerateNginx (t * testing.T ) {
6772 cfg := Config {
68- Listen : 8080 ,
69- ListenSSL : 8443 ,
70- ServerName : "example.com" ,
71- RedirectHTTP : true ,
73+ Listen : 8080 ,
74+ ListenSSL : 8443 ,
75+ ServerName : "example.com" ,
76+ LoggingEnabled : false ,
77+ RedirectHTTP : true ,
7278 CustomKeywords : []KeywordRule {{
7379 Phrase : "foo" ,
7480 Dest : "google" ,
@@ -87,4 +93,10 @@ func TestGenerateNginx(t *testing.T) {
8793 if ! strings .Contains (out , "~*(?i)^foo$" ) {
8894 t .Errorf ("generated config missing custom rule: %s" , out )
8995 }
96+ if ! strings .Contains (out , "access_log off;" ) {
97+ t .Errorf ("generated config missing access log disable: %s" , out )
98+ }
99+ if ! strings .Contains (out , "error_log /dev/null crit;" ) {
100+ t .Errorf ("generated config missing error log disable: %s" , out )
101+ }
90102}
0 commit comments