Add proper shutdown, rate limits, config validation, cors config, fix dangling cursors, cache regex, merge created texts
This commit is contained in:
parent
4763bc9d04
commit
e15b0f9903
28 changed files with 1277 additions and 464 deletions
|
|
@ -27,6 +27,19 @@ pub struct Config {
|
|||
}
|
||||
|
||||
impl Config {
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
self.server
|
||||
.validate()
|
||||
.context("Invalid server configuration")?;
|
||||
self.logging
|
||||
.validate()
|
||||
.context("Invalid logging configuration")?;
|
||||
self.database
|
||||
.validate()
|
||||
.context("Invalid database configuration")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn read_or_create(path: &Path) -> Result<Self> {
|
||||
let display_path = path.canonicalize().unwrap_or_else(|_| path.to_path_buf());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue