website/lib/DB/BlogMeta.rakumod

32 lines
669 B
Raku
Raw Normal View History

2025-01-22 19:55:18 -05:00
use v6.e.PREVIEW;
use JSON::Class:auth<zef:vrurg>;
# Top level metadata for the blog
unit class BlogMeta is json(:pretty);
#| The title of the blog
has Str:D $.title is required is rw;
2025-01-22 19:55:18 -05:00
#| The tagline of the blog
has Str:D $.tagline is required is rw;
#| The id of the placeholder post
has Int:D $.placeholder-id is rw = 0;
2025-02-05 03:26:39 -05:00
#| The id of the about post
has Int:D $.about-id is rw = 0;
2025-02-05 04:37:28 -05:00
#| The base url of this post
has Str:D $.base-url is required;
#| Return the base url, but substitute it out if the test environment variable
#| is set
method get-base-url(--> Str:D) {
2025-02-09 01:25:33 -05:00
if %*ENV<LOCAL_RSS> {
"http://localhost:8000"
2025-02-05 04:37:28 -05:00
} else {
$!base-url
}
}