Skip to main content

Environment variables

BookLogr uses environment variables to customize and set important variables across the app and between services. The variables and how they work are described below.

⚠️ The environment variables need to be changed in order to deploy booklogr to production.

.env file

VariableOptionsDefaultDescription
DATABASE_URLSQLAlchemy Database URLsqlite:///books.dbUsed by the API server and points to where the database is hosted. Use either SQLite or PostgreSQL. For PostgreSQL use postgresql://admin:password@booklogr-db/booklogr and use the env variables POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB and set them accordingly. Note: for PostgreSQL, when using docker it is important that the host part uses the same name as the database container.
AUTH_SECRET_KEYTextthis-really-needs-to-be-changedThe secret key for authentication. Change this to something completely random when deploying to production
AUTH_ALLOW_REGISTRATIONTrue or FalseTrueAllows non-authenticated users to sign up for an account. Set to False to not allow sign ups.
AUTH_REQUIRE_VERIFICATIONTrue or FalseFalseWhen registration is allowed, also require the user to verify their email adress. Set to False to not require verification.
GOOGLE_CLIENT_IDTextNoneChange this to your own Google Client ID if you want to allow authentication with Google
GOOGLE_CLIENT_SECRETTextxxxChange this to your own Google Client Secret if you want to allow authentication with Google
POSTGRES_USERTextadminThe user to authenticate against the database with if using PostgreSQL
POSTGRES_PASSWORDTextpasswordThe password for the user to authenticate against the database if using PostgreSQL.
POSTGRES_DBTextbooklogrThe name of the database if using PostgreSQL.
AUTH_DEFAULT_USERText (email address)Commented outUncomment and type in an email adress if you want to create a specific user on startup. Example use case is the demo instance.
AUTH_DEFAULT_PASSWORDText (email address)Commented outPassword for the user set with AUTH_DEFAULT_USER

Service: booklogr-web

VariableOptionsDefaultDescription
BL_API_ENDPOINTURLhttp://localhost:5000/URL to the booklogr API service.
BL_GOOGLE_IDTextEmptyLeave empty to disable Google Login. Change this to your own Google Client ID if you want to allow authentication with Google. Set this to the same as in the .env file in the root directory.
BL_DISABLE_HOMEPAGEtrue or falsefalseRemoves the homepage and redirects directly to login page or library (if you are already logged in).
BL_DEMO_MODEtrue or falsefalseAdds information to login screen and removes features such as Google Login, used for demo purposes.

.env file for frontend

The frontend has it's own .env file located in the web directory. This is because Vite, the frontend tooling used in this project requires environment variables to be prefixed with VITE_. This causes some duplicate environment variables.

warning

These are only used if building from source or in a development fashion. If you are using docker and want to set these variables, see the table Service: booklogr-web above.

VariableOptionsDefaultDescription
VITE_API_ENDPOINTURLhttp://localhost:5000/URL to the booklogr API service.
VITE_GOOGLE_CLIENT_IDTextXXX.apps.googleusercontent.comChange this to your own Google Client ID if you want to allow authentication with Google. Set this to the same as in the .env file in the root directory.
VITE_DISABLE_HOMEPAGEtrue or falsefalseRemoves the homepage and redirects directly to login page or library (if you are already logged in).
VITE_DEMO_MODEtrue or falsefalseAdds information to login screen and removes features such as Google Login, used for demo purposes.