One and a half years ago I moved to a self-hosted CommaFeed instance for RSS feed reading. It’s great and I never looked back. The only gripe I have is that every time I restart the server or the docker container it runs in, I have to enter the password again. This wasn’t a problem until recently, but server patches seem to come in on an hourly basis these days. On the PC I wouldn’t mind the quick click on the login button. On my smartphone however, the passwords in the browser are better protected with a KeePassX integration. So entering a password requires to switch from the browser to KeePassX to open the password vault, and then to return to the web page. Doesn’t sound like much, but it does get in the way. So long story short, I was looking for a way how to make the login persistent for as long as possible. For a dockerized Commafeed server, here’s how to do it:
The login can be made persistent across reboots and container restarts by setting the secret key in an environment variable instead of generating a new at every startup. Here are the environment variables that are required for the Docker compose file and how to initially generate the secret key:
environment:
# fixed key, so logins survive restarts (min. 16 chars; generate with: openssl rand -hex 32)
- QUARKUS_HTTP_AUTH_SESSION_ENCRYPTION_KEY=put-your-long-secret-here
# effectively "never" expire: 10 years idle timeout and cookie lifetime
- QUARKUS_HTTP_AUTH_FORM_TIMEOUT=P3650D
- QUARKUS_HTTP_AUTH_FORM_COOKIE_MAX_AGE=P3650D
Have fun!