diff --git a/server/.env.example b/server/.env.example new file mode 100644 index 0000000..536caab --- /dev/null +++ b/server/.env.example @@ -0,0 +1 @@ +APP_JWT_SECRET=replace-with-a-base64-or-raw-dev-secret diff --git a/server/.gitignore b/server/.gitignore index 667aaef..20356be 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -31,3 +31,9 @@ build/ ### VS Code ### .vscode/ + +# Local environment overrides +.env +.env.local +.env.* +!.env.example diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties index 147017f..b194b27 100644 --- a/server/src/main/resources/application.properties +++ b/server/src/main/resources/application.properties @@ -1,11 +1,11 @@ spring.application.name=yealch +spring.config.import=optional:file:.env[.properties] # Enables H2 console to view database tables at http://localhost:8080/h2-console spring.h2.console.enabled=true spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.username=sa spring.datasource.password= -#TODO: read from environment (file) -# Base64-encoded dev secret for JWT signing. Replace for production. -app.jwt.secret=YWVhbGNoLWRldi1zZWNyZXQtZm9yLWp3dC1hdXRoLXNvLXNoYXJlLXRoaXMtY29tcHV0ZXItMzI= +# JWT signing secret must be provided externally, for example via APP_JWT_SECRET. +app.jwt.secret=${APP_JWT_SECRET} app.jwt.expiration-minutes=60 \ No newline at end of file