Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
b0bc2ea611 | |||
e44f4e48b9 | |||
514d4e033d | |||
cf85c60c1c |
3 changed files with 10 additions and 5 deletions
|
@ -139,8 +139,11 @@ impl Default for CacheConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn load() -> Result<Config> {
|
pub async fn load() -> Result<Config> {
|
||||||
let config_file = env::var(format!("{}_CONFIG", env!("CARGO_BIN_NAME")))
|
let config_file = env::var(format!(
|
||||||
.unwrap_or(String::from("config.toml"));
|
"{}_CONFIG",
|
||||||
|
env!("CARGO_BIN_NAME").to_uppercase().replace("-", "_")
|
||||||
|
))
|
||||||
|
.unwrap_or(String::from("config.toml"));
|
||||||
match tokio::fs::OpenOptions::new()
|
match tokio::fs::OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.open(&config_file)
|
.open(&config_file)
|
||||||
|
|
|
@ -4,10 +4,9 @@ use chrono::{DateTime, TimeZone};
|
||||||
|
|
||||||
use crate::post::PostMetadata;
|
use crate::post::PostMetadata;
|
||||||
|
|
||||||
pub fn date<T: TimeZone>(date: &DateTime<T>) -> Result<String, askama::Error> {
|
pub fn date<Utc: TimeZone>(date: &DateTime<Utc>) -> Result<String, askama::Error> {
|
||||||
Ok(date.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))
|
Ok(date.to_utc().format("%Y-%m-%d %H:%M:%S UTC").to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn duration(duration: &&Duration) -> Result<String, askama::Error> {
|
pub fn duration(duration: &&Duration) -> Result<String, askama::Error> {
|
||||||
Ok(format!("{:?}", duration))
|
Ok(format!("{:?}", duration))
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
<h2>posts</h2>
|
<h2>posts</h2>
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<div>
|
<div>
|
||||||
|
{% if posts.is_empty() %}
|
||||||
|
there are no posts right now. check back later!
|
||||||
|
{% endif %}<!-- prettier-br -->
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<a href="/posts/{{ post.name }}"><b>{{ post.title }}</b></a>
|
<a href="/posts/{{ post.name }}"><b>{{ post.title }}</b></a>
|
||||||
|
|
Loading…
Reference in a new issue