chore: update environment configuration and Docker setup
- Added .env.example file for environment variable documentation - Refactored docker-compose.yml to use environment variables for API URLs - Updated TypeScript configuration to use NodeNext module resolution
This commit is contained in:
parent
f5638d0e84
commit
cffcddb259
5 changed files with 25 additions and 22 deletions
19
.env.example
Normal file
19
.env.example
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# API
|
||||||
|
DATABASE_URL="mysql://user:password@localhost:3306/db_name"
|
||||||
|
ALLOWED_ORIGINS="http://localhost:5173"
|
||||||
|
API_HOST=0.0.0.0
|
||||||
|
API_PORT=4000
|
||||||
|
COOKIE_SECRET=your-secret-key
|
||||||
|
MEMC_HOST=localhost
|
||||||
|
MEMC_PORT=11211
|
||||||
|
MINIO_ACCESS_KEY=your-access-key
|
||||||
|
MINIO_BUCKET_NAME=your-bucket-name
|
||||||
|
MINIO_ENDPOINT=your-endpoint
|
||||||
|
MINIO_SECRET_KEY=your-secret-key
|
||||||
|
MINIO_USE_SSL=true
|
||||||
|
NODE_ENV=production
|
||||||
|
TOKEN_SECRET=your-secret-key
|
||||||
|
|
||||||
|
# Web
|
||||||
|
VITE_API_URL=http://localhost:4000/graphql
|
||||||
|
VITE_WS_URL=ws://localhost:4000/graphql
|
14
README.md
14
README.md
|
@ -42,19 +42,7 @@ npm install
|
||||||
|
|
||||||
3. Set up environment variables:
|
3. Set up environment variables:
|
||||||
|
|
||||||
Create a `.env` file in the `apps/api` directory:
|
Copy the `.env.example` file to `.env`, then update the values as needed.
|
||||||
|
|
||||||
```
|
|
||||||
DATABASE_URL="mysql://root:password@localhost:3306/unreal_chat"
|
|
||||||
JWT_SECRET="your-secret-key"
|
|
||||||
```
|
|
||||||
|
|
||||||
Create a `.env` file in the `apps/web` directory:
|
|
||||||
|
|
||||||
```
|
|
||||||
VITE_API_URL=http://localhost:4000/graphql
|
|
||||||
VITE_WS_URL=ws://localhost:4000/graphql
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Initialize the database:
|
4. Initialize the database:
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ export const hashPassword = (password: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const verifyPassword = (password: string, hashedPassword: string) => {
|
export const verifyPassword = (password: string, hashedPassword: string) => {
|
||||||
const [salt, hash] = hashedPassword.split(':');
|
const [salt, hash] = hashedPassword.split(':') as [string, string];
|
||||||
const hashBuffer = Buffer.from(hash, 'hex');
|
const hashBuffer = Buffer.from(hash, 'hex');
|
||||||
const result = pbkdf2Sync(password, salt, 1000, 128, 'sha512');
|
const result = pbkdf2Sync(password, salt, 1000, 128, 'sha512');
|
||||||
return timingSafeEqual(hashBuffer, result);
|
return timingSafeEqual(hashBuffer, result);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
// "extends": "@repo/typescript-config/base.json",
|
"extends": "@repo/typescript-config/base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||||
|
|
||||||
/* Basic Options */
|
/* Basic Options */
|
||||||
// "incremental": true, /* Enable incremental compilation */
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
"target": "es2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
"target": "es2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
||||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
"module": "NodeNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
||||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
// "checkJs": true, /* Report errors in .js files. */
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
|
|
@ -27,14 +27,10 @@ services:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./apps/web/Dockerfile
|
dockerfile: ./apps/web/Dockerfile
|
||||||
args:
|
args:
|
||||||
VITE_API_URL: https://chat-api.jusemon.com/graphql
|
VITE_API_URL: ${VITE_API_URL}
|
||||||
VITE_WS_URL: wss://chat-api.jusemon.com/graphql
|
VITE_WS_URL: ${VITE_WS_URL}
|
||||||
container_name: unreal-chat-web
|
container_name: unreal-chat-web
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
|
||||||
- NODE_ENV=production
|
|
||||||
- VITE_API_URL=https://chat-api.jusemon.com/graphql
|
|
||||||
- VITE_WS_URL=wss://chat-api.jusemon.com/graphql
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue