Commit graph

13 commits

Author SHA1 Message Date
Gergely Nagy
0b76a1633e
No need for a Mutex
Some checks are pending
build / binary (push) Waiting to run
build / binary-static (push) Waiting to run
build / container (push) Waiting to run
build / clippy (push) Waiting to run
lint / linting (push) Waiting to run
There's no need for a `Mutex` in `StatefulIocaine`, so drop it - keep
only `Arc`.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-04 01:43:04 +01:00
Gergely Nagy
a0410a528d
Slightly reduce the amount of cloning
Some checks are pending
build / binary (push) Waiting to run
build / binary-static (push) Waiting to run
build / container (push) Waiting to run
build / clippy (push) Waiting to run
lint / linting (push) Waiting to run
Rather than cloning `Iocaine` (along with the markov chain & everything)
all over the place, declare it shared state behind an `Arc<Mutex>`. This
should reduce the amount of cloning done noticably.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-03 23:37:03 +01:00
Gergely Nagy
aa4c387605
Add a number of tests
Some checks are pending
build / binary (push) Waiting to run
build / binary-static (push) Waiting to run
build / container (push) Waiting to run
build / clippy (push) Waiting to run
lint / linting (push) Waiting to run
These are quite... simple, and cover little, but it's more than nothing!

While there, enable tests in the Nix package, so they're run in CI too.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-30 09:18:35 +01:00
Gergely Nagy
a039cf2310
Update rand & rand_chacha to 0.9.0
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-30 07:47:39 +01:00
Gergely Nagy
ae8b06a4d5
Make templating actually useful
This rebuilds the templating so that the *content* is no longer
pre-generated, only the parameters. It is up to the template (and some
newly implemented helper functions) to construct the output from those.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-29 00:20:21 +01:00
Gergely Nagy
5d60b84300
Make the generated HTML templatable
Use Handlebars to generate the HTML output, to make it easier to change.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-28 08:50:22 +01:00
Gergely Nagy
e3306e7998
Slight environment variable adjustment
When configuring iocaine via environment variables, sections and
settings were separated by two underlines, but the `IOCAINE_` prefix
only had one. This felt weird, so now iocaine supports an `IOCAINE__`
prefix too, and keeps recognizing the old one too.

Documentation and examples updated to use the new naming. No mention of
the backwards compatibility - I'll just silently support that.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-25 02:16:06 +01:00
Gergely Nagy
b214131d8b
app: Implement graceful shutdown
When calling `axum::serve`, use `.with_graceful_shutdown()` to register
a `ctrl+c` handler, so that Iocaine can be gracefully shut down. This
also allows gracefully shutting it down when running inside a container.

Fixes #1, thanks @alciregi!

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-19 22:04:55 +01:00
Gergely Nagy
764cf9afd0
Add an "initial_seed" option
The initial seed is used by the RNG, and the intended use is to allow
modifying the generated output without otherwise modifying the
configuration, while still being a static, controllable seed that can be
shared between instances if need be.

Thanks to @buherator@infosec.place for the idea!

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-19 19:16:04 +01:00
Gergely Nagy
598338094c
Fix the tokio-console feature
Don't initialize `tracing_subscriber` if the `tokio-console` feature is
enabled - they conflict.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 14:20:38 +01:00
Gergely Nagy
a01cb16ae0
cli: Default to "config.toml" as config file
This is expected to run through a systemd system service, with the
config file explicitly specified. Using XDG for the default config makes
little sense in that case, and ends up causing issues with a strict
systemd service file.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 12:24:16 +01:00
Gergely Nagy
9658f95ac3
poison: Remove a superfluous <p></p>
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 12:23:25 +01:00
Gergely Nagy
f28642532d
Initial import
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 10:44:56 +01:00