mirror of
https://github.com/agersant/polaris
synced 2024-12-03 10:09:09 +00:00
Implemented endpoint to write settings
This commit is contained in:
parent
0ebcc8a280
commit
769c12833a
1 changed files with 7 additions and 1 deletions
|
@ -12,7 +12,7 @@ const CURRENT_MAJOR_VERSION: i32 = 2;
|
|||
const CURRENT_MINOR_VERSION: i32 = 2;
|
||||
|
||||
pub fn get_routes() -> Vec<rocket::Route> {
|
||||
routes![version, initial_setup, get_settings,]
|
||||
routes![version, initial_setup, get_settings, put_settings]
|
||||
}
|
||||
|
||||
struct Auth {
|
||||
|
@ -88,3 +88,9 @@ fn get_settings(db: State<DB>, _admin_rights: AdminRights) -> Result<Json<Config
|
|||
let config = config::read::<DB>(&db)?;
|
||||
Ok(Json(config))
|
||||
}
|
||||
|
||||
#[put("/settings", data = "<config>")]
|
||||
fn put_settings(db: State<DB>, _admin_rights: AdminRights, config: Json<Config>) -> Result<(), errors::Error> {
|
||||
config::amend::<DB>(&db, &config)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue