generated from xgeekshq/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a701565
commit cb5b766
Showing
20 changed files
with
281 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,55 @@ | ||
# database host value | ||
DB_HOST=localhost | ||
|
||
# admin username | ||
#admin db user | ||
DB_ROOT_USER=admin | ||
|
||
# admin password | ||
DB_ROOT_PASSWORD=password | ||
#admin db password | ||
DB_ROOT_PASSWORD=123456 | ||
|
||
#db user | ||
DB_USER=backend | ||
|
||
#db password | ||
DB_PASSWORD=dc2021backend | ||
|
||
#db name | ||
DB_NAME=dc | ||
|
||
#docker database container name | ||
DB_HOST=mongo | ||
|
||
#----------- | ||
|
||
#db port | ||
DB_PORT=27017 | ||
|
||
#backend port | ||
BACKEND_PORT=3200 | ||
|
||
#secret to sign access token in backend | ||
JWT_ACCESS_TOKEN_SECRET=backenddc2021 | ||
|
||
#access token expiration time in seconds | ||
JWT_ACCESS_TOKEN_EXPIRATION_TIME=900 | ||
|
||
#secret to sign refresh token in backend | ||
JWT_REFRESH_TOKEN_SECRET=backenddc2021refresh | ||
|
||
#refresh token expiration time in days | ||
JWT_REFRESH_TOKEN_EXPIRATION_TIME=1 | ||
|
||
#backend url exposed to the browser | ||
NEXT_PUBLIC_BACKEND_URL=http://localhost:3200 | ||
|
||
#backend url in server side | ||
BACKEND_URL=http://backend | ||
|
||
#auth url | ||
NEXTAUTH_URL=http://localhost:3000 | ||
|
||
# user with lower privileges | ||
DB_USER=dcuser | ||
#auth url exposed to the browser | ||
NEXT_PUBLIC_NEXTAUTH_URL=http://localhost:3000 | ||
|
||
# password for the user | ||
DB_PASSWORD=password | ||
#secret to encode jwt in frontend | ||
SECRET=56e9169e3383d4a73fef9e0b4a3ff4e2 | ||
|
||
# database name | ||
DB_NAME=dc | ||
#jwt expiration time exposed to the browser | ||
NEXT_PUBLIC_EXPIRATION_TIME=900 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/* | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
# database host value | ||
|
||
#docker database container name | ||
DB_HOST=localhost | ||
|
||
# user with lower privileges | ||
DB_USER=dcuser | ||
#db user | ||
DB_USER=backend | ||
|
||
# password for the user | ||
DB_PASSWORD=password | ||
#db password | ||
DB_PASSWORD=dc2021backend | ||
|
||
# database name | ||
#db name | ||
DB_NAME=dc | ||
|
||
# database port | ||
#db port | ||
DB_PORT=27017 | ||
|
||
# backend port | ||
#backend poxrt | ||
BACKEND_PORT=3200 | ||
|
||
# a strong secret to sign the access tokens | ||
JWT_ACCESS_TOKEN_SECRET=a_strong_secret | ||
#secret to sign access token in backend | ||
JWT_ACCESS_TOKEN_SECRET=backenddc2021 | ||
|
||
# expiration time of refresh token in seconds | ||
#access token expiration time in seconds | ||
JWT_ACCESS_TOKEN_EXPIRATION_TIME=900 | ||
|
||
# a strong secret to sign the refresh tokens | ||
JWT_REFRESH_TOKEN_SECRET=another_strong_secret | ||
#secret to sign refresh token in backend | ||
JWT_REFRESH_TOKEN_SECRET=backenddc2021refresh | ||
|
||
# expiration time of refresh token in days | ||
#refresh token expiration time in days | ||
JWT_REFRESH_TOKEN_EXPIRATION_TIME=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM node:17-alpine as builder | ||
|
||
ENV NODE_ENV build | ||
|
||
WORKDIR /home/node | ||
|
||
COPY . /home/node | ||
|
||
RUN npm ci \ | ||
&& npm run build \ | ||
&& npm prune --production | ||
|
||
# --- | ||
|
||
FROM node:17-alpine | ||
|
||
ENV NODE_ENV production | ||
|
||
EXPOSE 3200 | ||
|
||
ENV PORT 3200 | ||
|
||
USER node | ||
WORKDIR /home/node | ||
|
||
COPY --from=builder /home/node/package*.json /home/node/ | ||
COPY --from=builder /home/node/node_modules/ /home/node/node_modules/ | ||
COPY --from=builder /home/node/dist/ /home/node/dist/ | ||
|
||
CMD ["node", "dist/src/main.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,7 @@ | ||
export const JWT_REFRESH_TOKEN_SECRET = Symbol('refresh token secret'); | ||
export const JWT_REFRESH_TOKEN_EXPIRATION_TIME = Symbol( | ||
'refresh token expiration time', | ||
); | ||
export const JWT_REFRESH_TOKEN_SECRET = 'JWT_REFRESH_TOKEN_SECRET'; | ||
export const JWT_REFRESH_TOKEN_EXPIRATION_TIME = | ||
'JWT_REFRESH_TOKEN_EXPIRATION_TIME'; | ||
|
||
export const JWT_ACCESS_TOKEN_SECRET = Symbol('access token secret'); | ||
export const JWT_ACCESS_TOKEN_EXPIRATION_TIME = Symbol( | ||
'access token expiration time', | ||
); | ||
|
||
export function describeJWT(key: symbol): string { | ||
switch (key) { | ||
case JWT_REFRESH_TOKEN_SECRET: | ||
return 'JWT_REFRESH_TOKEN_SECRET'; | ||
case JWT_REFRESH_TOKEN_EXPIRATION_TIME: | ||
return 'JWT_REFRESH_TOKEN_EXPIRATION_TIME'; | ||
case JWT_ACCESS_TOKEN_SECRET: | ||
return 'JWT_ACCESS_TOKEN_SECRET'; | ||
case JWT_ACCESS_TOKEN_EXPIRATION_TIME: | ||
return 'JWT_ACCESS_TOKEN_EXPIRATION_TIME'; | ||
default: | ||
return 'ERROR'; | ||
} | ||
} | ||
export const JWT_ACCESS_TOKEN_SECRET = 'JWT_ACCESS_TOKEN_SECRET'; | ||
export const JWT_ACCESS_TOKEN_EXPIRATION_TIME = | ||
'JWT_ACCESS_TOKEN_EXPIRATION_TIME'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.