Open jamesmunns opened 3 months ago
As discussed in #165, IMO at least I'm not opposed to separating out the yaml/config file handling itself into a separate crate and keeping ServerConf
agnostic, perhaps included alongside other Conf
per service type (e.g. proxy-specific config) in a base config file.
@jamesmunns I think separating the config handling out into its own crate deserves its own issue. Would you mind if I opened a separate issue for that and closed this one?
@drcaramelsyrup Up to you! There's two parts:
I think having a specific issue for the latter is good, and happy to weigh in/answer any questions!
What is the problem your feature solves, or the need it fulfills?
At the moment, there is no constructor for
Server
that allows you to fully set the contents ofServerConf
. You can create a server with anOpt
that has aNone
field for a conf path, and theconfiguration
field ofServer
is public, but not all fields ofServerConf
are public:https://github.com/cloudflare/pingora/blob/0de54eb9071a9c4baccc6bad7acad11e9c54186f/pingora-core/src/server/configuration/mod.rs#L36-L69
This is a little silly though -
ServerConf
implementsDeserialize
, which means I could write my own contents in JSON or YAML and deserialize it myself, meaning that the non-public fields are not effective if the intent is to prevent user modification.For the
river
application, we will likely have our own configuration file format, so it would be good to be able to disable (or at least skip) the built-in YAML configuration format used by thepingora
crate. It may be good to split this functionality into an optionalpingora-config
crate, as "frontends" to pingora like river may want to use their own.Describe the solution you'd like
Server
that takesServerConf
directly (and maybe notOpt
at all?)ServerConf
public, or provide some methods to be able to set all fieldsDescribe alternatives you've considered
If this is not implemented, I will need to either:
Additional context
This is for the
river
application.