Closed wbtlb closed 3 weeks ago
Sorry for the delay on responding. What do you mean by user config settings?
If you're asking about a configuration file like nginx's, Pingora's current config files are more limited than nginx's and are limited to environment setup, e.g. see the (as-of-today) YAML formatted ServerConf
and the user guide.
I mean extand ServerConf with my own configuration parameters.
I think your best bet is to use serde
's ability to flatten de/serialized structures. Our serverconf is just a struct with a few derives. If you wanted to add some extra configurations to the same file, you could so something like
#[derive(Serialize, Deserialize)]
struct CombinedConf {
// All pingora configurations come in here
#[serde(flatten)]
base_conf: ServerConf,
// Any of your configurations can go here
#[serde(flatten)]
custom_conf: CustomConf,
}
#[derive(Serialize, Deserialize)]
struct CustomConf {
awesomeness_count: f64
// ...
}
For certain format like yaml and json you can even add your custom field directly into the server_conf.yaml
---
version: 1
threads: 2
awesomeness_count: 3
The yaml above can be directly deserialized to CustomConf
. All the fields that are not in your CustomConf
are ignored. All the custom fields are ignored by the ServerConf
as well.
This question has been stale for a week. It will be closed in an additional day if not updated.
This issue has been closed because it has been stalled with no activity.
How can I add new user config settings.