Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf583f5ff6 | ||
| d3dbb6e673 | |||
|
|
851b3a6076 | ||
|
|
dbc3103980 | ||
|
|
2dacd4f747 | ||
| 94ede9a168 | |||
|
|
c38574e005 | ||
|
|
700d53fbb0 | ||
|
|
c5c11ed181 | ||
| 36c9b880a7 |
12
README.md
12
README.md
@ -41,8 +41,10 @@ By setting `$BASE_DIR` you can persist the database for later runs.
|
||||
|
||||
## TODO
|
||||
|
||||
- CI
|
||||
- Docker container (in flake)
|
||||
- try fourmolu
|
||||
- Test leap second handling in the `time` package
|
||||
- use queue to sync logging of indexer and main thread
|
||||
- [x] CI
|
||||
- [x] Docker container (in flake)
|
||||
- [x] try fourmolu
|
||||
- [x] Test leap second handling in the `time` package
|
||||
- [ ] Fix container shutdown delay
|
||||
- [ ] Fix `responseFile` always returning 200
|
||||
- [ ] use queue to sync logging of indexer and main thread
|
||||
|
||||
@ -65,6 +65,7 @@ import Data.Time.Clock.POSIX (getPOSIXTime)
|
||||
import qualified Envy
|
||||
import qualified Yore.DB as DB
|
||||
import qualified Yore.Log as Log
|
||||
import System.IO (hSetBuffering, BufferMode (..), stdout)
|
||||
|
||||
data ConfigT f = Config
|
||||
{ yorePort :: f =@@ Int ? 3000
|
||||
@ -79,6 +80,8 @@ deriving instance Show Config
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
hSetBuffering stdout NoBuffering
|
||||
|
||||
cfg <-
|
||||
Envy.load @ConfigT >>= \case
|
||||
Left errs -> do
|
||||
|
||||
23
flake.nix
23
flake.nix
@ -64,19 +64,30 @@
|
||||
name = "git.pbrinkmeier.de/paul/yore";
|
||||
tag = yore.version;
|
||||
copyToRoot = [ pkgs.cacert ];
|
||||
config.Cmd = [ "${entrypoint}/bin/run" ];
|
||||
config = {
|
||||
Cmd = [ "${entrypoint}/bin/run" ];
|
||||
StopSignal = "SIGINT";
|
||||
};
|
||||
};
|
||||
|
||||
entrypoint = pkgs.writeShellApplication {
|
||||
name = "run";
|
||||
runtimeInputs = [ pkgs.coreutils pkgs.dbmate yore ];
|
||||
text = ''
|
||||
mkdir -p /workspace/db
|
||||
cp -r ${./db}/* /workspace/db
|
||||
cd /workspace
|
||||
dbmate up
|
||||
set -Eeuo pipefail
|
||||
|
||||
yore
|
||||
mkdir -p "''${YORE_DBMATE_DIR}"
|
||||
TMPDIR=$(mktemp -dp "''${YORE_DBMATE_DIR}")
|
||||
mkdir -p "''${TMPDIR}/db"
|
||||
cp -r ${./db}/* "''${TMPDIR}/db"
|
||||
cd "''${TMPDIR}"
|
||||
dbmate up
|
||||
chmod +w -R "''${TMPDIR}"
|
||||
rm -rf "''${TMPDIR}"
|
||||
|
||||
# Replace bash and inherit PID 1
|
||||
cd /
|
||||
exec yore
|
||||
'';
|
||||
};
|
||||
in {
|
||||
|
||||
@ -112,7 +112,7 @@ showpdfRequest (y, m, d) =
|
||||
NoReqBody
|
||||
bsResponse
|
||||
( formToQuery
|
||||
[ ("cmd" :: Text, "showpdf")
|
||||
[ ("cmd" :: Text, "showpdfjs")
|
||||
, ("year", y)
|
||||
, ("month", m)
|
||||
, ("day", d)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
cabal-version: 3.4
|
||||
|
||||
name: yore
|
||||
version: 0.0.2
|
||||
version: 0.0.9
|
||||
author: Paul Brinkmeier
|
||||
maintainer: hallo@pbrinkmeier.de
|
||||
copyright: 2023 Paul Brinkmeier
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user