@@ -32,7 +32,7 @@ var ConfigFolders = []string{httpFolder, secretsFolder}
32
32
// This interface is used for testing purposes only.
33
33
type Generator interface {
34
34
// Generate generates NGINX configuration files from internal representation.
35
- Generate (configuration * dataplane.Configuration ) []file.File
35
+ Generate (configuration dataplane.Configuration ) []file.File
36
36
}
37
37
38
38
// GeneratorImpl is an implementation of Generator.
@@ -43,15 +43,11 @@ type Generator interface {
43
43
//
44
44
// It also expects that the main NGINX configuration file nginx.conf is located in configFolder and nginx.conf
45
45
// includes (https://nginx.org/en/docs/ngx_core_module.html#include) the files from httpFolder.
46
- type GeneratorImpl struct {
47
- configVersion int
48
- }
46
+ type GeneratorImpl struct {}
49
47
50
48
// NewGeneratorImpl creates a new GeneratorImpl.
51
49
func NewGeneratorImpl () GeneratorImpl {
52
- return GeneratorImpl {
53
- configVersion : 0 ,
54
- }
50
+ return GeneratorImpl {}
55
51
}
56
52
57
53
// executeFunc is a function that generates NGINX configuration from internal representation.
@@ -61,18 +57,16 @@ type executeFunc func(configuration dataplane.Configuration) []byte
61
57
// It is the responsibility of the caller to validate the configuration before calling this function.
62
58
// In case of invalid configuration, NGINX will fail to reload or could be configured with malicious configuration.
63
59
// To validate, use the validators from the validation package.
64
- func (g * GeneratorImpl ) Generate (conf * dataplane.Configuration ) []file.File {
65
- g .configVersion ++
66
- conf .Version = g .configVersion
60
+ func (g GeneratorImpl ) Generate (conf dataplane.Configuration ) []file.File {
67
61
files := make ([]file.File , 0 , len (conf .SSLKeyPairs )+ 1 /* http config */ )
68
62
69
63
for id , pair := range conf .SSLKeyPairs {
70
64
files = append (files , generatePEM (id , pair .Cert , pair .Key ))
71
65
}
72
66
73
- files = append (files , generateHTTPConfig (* conf ))
67
+ files = append (files , generateHTTPConfig (conf ))
74
68
75
- files = append (files , generateConfigVersion (g . configVersion ))
69
+ files = append (files , generateConfigVersion (conf . Version ))
76
70
77
71
return files
78
72
}
0 commit comments