Skip to content

Commit

Permalink
refactor: rename env var (#64)
Browse files Browse the repository at this point in the history
* refactor: rename env var

* fix: authorities
  • Loading branch information
bryson-g authored Jan 22, 2025
1 parent 2209ffe commit fd530a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ AUTH_URL='http://localhost:3000'
NEXTAUTH_URL='http://localhost:3000'
AUTH_SECRET='<any secret here>'

AUTH_KEYCLOAK_ID='user-tasks-client'
AUTH_KEYCLOAK_CLIENT_ID='user-tasks-client'
AUTH_KEYCLOAK_SECRET=' '
AUTH_KEYCLOAK_ISSUER='http://localhost:8888/realms/default'

Expand Down Expand Up @@ -192,7 +192,7 @@ docker run --rm \
-e AUTH_URL='https://localhost:3443' \
-e NEXTAUTH_URL='https://localhost:3443' \
-e AUTH_SECRET='your-secret-here' \
-e AUTH_KEYCLOAK_ID='user-tasks-client' \
-e AUTH_KEYCLOAK_CLIENT_ID='user-tasks-client' \
-e AUTH_KEYCLOAK_SECRET=' ' \
-e AUTH_KEYCLOAK_ISSUER='http://localhost:8888/realms/default' \
-e LHUT_API_URL='http://localhost:8089' \
Expand All @@ -208,16 +208,16 @@ When SSL is enabled, the UI will be available on:

### Environment Variables for SSL

| Variable | Description | Required |
| ---------------------- | ---------------------------------------------------------- | -------- |
| `SSL` | Set to `enabled` to enable SSL | Yes |
| `AUTH_URL` | Full URL where the app will be accessible (use HTTPS port) | Yes |
| `AUTH_SECRET` | Random string used to hash tokens | Yes |
| `AUTH_KEYCLOAK_ID` | Client ID from Keycloak | Yes |
| `AUTH_KEYCLOAK_SECRET` | Client secret from Keycloak | Yes |
| `AUTH_KEYCLOAK_ISSUER` | Keycloak server URL | Yes |
| `LHUT_API_URL` | URL of the User Tasks API | Yes |
| `AUTHORITIES` | Paths to extract roles from the token | Yes |
| Variable | Description | Required |
| ------------------------- | ---------------------------------------------------------- | -------- |
| `SSL` | Set to `enabled` to enable SSL | Yes |
| `AUTH_URL` | Full URL where the app will be accessible (use HTTPS port) | Yes |
| `AUTH_SECRET` | Random string used to hash tokens | Yes |
| `AUTH_KEYCLOAK_CLIENT_ID` | Client ID from Keycloak | Yes |
| `AUTH_KEYCLOAK_SECRET` | Client secret from Keycloak | Yes |
| `AUTH_KEYCLOAK_ISSUER` | Keycloak server URL | Yes |
| `LHUT_API_URL` | URL of the User Tasks API | Yes |
| `AUTHORITIES` | Paths to extract roles from the token | Yes |

### Notes

Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if [ ! "${AUTH_SECRET+x}" ]; then
exit 1
fi

if [ ! "${AUTH_KEYCLOAK_ID+x}" ]; then
echo "Provide the AUTH_KEYCLOAK_ID env variable"
if [ ! "${AUTH_KEYCLOAK_CLIENT_ID+x}" ]; then
echo "Provide the AUTH_KEYCLOAK_CLIENT_ID env variable"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/api/auth/[...nextauth]/authOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import KeycloakProvider from "next-auth/providers/keycloak";
export const authOptions: NextAuthOptions = {
providers: [
KeycloakProvider({
clientId: `${process.env.AUTH_KEYCLOAK_ID}`,
clientId: `${process.env.AUTH_KEYCLOAK_CLIENT_ID}`,
clientSecret: `${process.env.AUTH_KEYCLOAK_SECRET}`,
issuer: `${process.env.AUTH_KEYCLOAK_ISSUER}`,
}),
Expand Down

0 comments on commit fd530a5

Please sign in to comment.