This genetator generates a file that will contains the needed functions to prepare a ServerParams to use in combination with add server command on the runtime socket.
This file will contain 3 functions:
func (p *ServerParams) prepareForRuntimeDoNotSendDisabledFields()
func (p *ServerParams) prepareForRuntimeDoNotSendEnabledFields()
func (p *ServerParams) PrepareFieldsForRuntimeAddServer()
They are used for example in Ingress Controller the following way:
params.PrepareFieldsForRuntimeAddServer()
serverParams := configuration.SerializeServerParams(defaultServer.ServerParams)
res := cp_params.ServerOptionsString(serverParams)
For example for Check that has the values [enabled disabled].
- if the value is
enabledwe must sendadd server check - if the value is
disabledwe must not sendadd server no-checkasno-checkis not allowed on a dynamic server
no-check is the default value.
The purpose is to set Check to "" when the value was disabled so the commands sent are:
add server checkif value isenabledadd serverif value isdisabled
It's just the opposite.
For example for NoSslv3
- if
enabledwe must sendno-sslv3 - if
disabledwe must not sent an option
is just calling both PrepareForRuntimeDoNotSendDisabledFields and PrepareForRuntimeDoNotSendEnabledFields
Just fill in server_params_prepare_for_runtime.go the map:
ServerParamsPrepareForRuntimeMap
for each field that has an // Enum: [enabled disabled]"
with the correct function to use
The generator checks all fields in ServerParams that have // Enum: [enabled disabled]" have an entry in the ServerParamsPrepareForRuntimeMap.
If a new field is added and not declared in ServerParamsPrepareForRuntimeMap, the generator fails with an error and this will make the CI fail.
