The entire mess with knot's internal server is due to the fact that we cannot share same config between different knot processes (server, keyfetch, guard...)
Let's introduce knot config file instead of env based config and remove the internal knot server. So all knot command will globally accept -config flag pointing to desired config file location.
-knot guard -user did:plc:user -git-dir /home/git -log-path /home/git/guard.log -internal-api http://localhost:5444 -motd-file /home/git/motd
+knot guard -config /home/git/knot.toml -user did:plc:user
This will make knot implementation a lot cleaner.
The knot config file format can be anything. toml, ini, .env or even json. Shouldn't matter much and can be changed by knot server implementations.
Though making db connection on each command might introduce a performance overhead especially on knot guard.
We can fix this by either using static AuthorizedKey file auto-updated on user change, or some kind of redis instance.
I think internal server is bit too much as a solution here.