create tmp cache directory if one is not specified

This commit is contained in:
realaravinth
2021-11-02 16:03:10 +05:30
parent 96a08fcb3f
commit b7e3f7348c
3 changed files with 18 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ pub type AppData = web::Data<Data>;
impl Data {
pub fn new() -> AppData {
let path = Path::new(&SETTINGS.cache).join("posts_cache");
let path = Path::new(SETTINGS.cache.as_ref().unwrap()).join("posts_cache");
let cache = sled::open(path).unwrap();
let posts = cache.open_tree("posts").unwrap();
AppData::new(Self {