Skip to content

Commit

Permalink
Editorconfig (#35)
Browse files Browse the repository at this point in the history
* Editor config
  • Loading branch information
makwanji authored Aug 8, 2024
1 parent 63ab3de commit 7022ce4
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 25 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab

[*.md]
# markdown uses two spaces at the end of the line for a line break
trim_trailing_whitespace = false

[*.{yaml,yml,js,json}]
indent_size = 2
17 changes: 17 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Database connection - App
DB_DATABASE=healthnest-db
DB_HOST=localhost
DB_PASSWORD=hel#net191
DB_USER=healthnest
DB_PORT=3306
# Database password
MYSQL_DATABASE=healthnest-db
MYSQL_PASSWORD=hna123
MYSQL_ROOT_PASSWORD=root123
MYSQL_USER=healthnest
# Port
PORT=8081
API_PORT=4000
# Frontned
BASE_URL="http://localhost:4000"
API_URL="http://localhost:4000"
17 changes: 17 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Database connection - App
DB_DATABASE=healthnest-db
DB_HOST=localhost
DB_PASSWORD=hel#net191
DB_USER=healthnest
DB_PORT=3306
# Database password
MYSQL_DATABASE=healthnest-db
MYSQL_PASSWORD=hna123
MYSQL_ROOT_PASSWORD=root123
MYSQL_USER=healthnest
# Port
PORT=8081
API_PORT=3000
# Frontned
BASE_URL="http://localhost:4000"
API_URL="http://localhost:4000"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
**/.env
# **/.env
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ cp .env.sample .env
```sql
-- Database user Creation
CREATE USER 'healthnest'@'%' IDENTIFIED WITH mysql_native_password BY 'hel#net191';
CREATE USER `healthnest`@`%` IDENTIFIED BY 'hel#net191';

-- Various Grant Permissions for DB-User
GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'healthnest'@'%' WITH GRANT OPTION;
GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO `healthnest`@`%` WITH GRANT OPTION;

-- Database Creation
CREATE DATABASE `healthnest-db`;
Expand All @@ -47,7 +49,7 @@ cp .env.sample .env
FLUSH PRIVILEGES;

-- View the DB-User Permission
SHOW GRANTS FOR 'healthnest'@'%';
SHOW GRANTS FOR `healthnest`@`%`;
```
3. Setup database - create tables
```bash
Expand Down
7 changes: 7 additions & 0 deletions backend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Database connection - App
DB_DATABASE=healthnest-db
DB_HOST=hndb.enblitz.com
DB_PASSWORD=hel#net191
DB_USER=healthnest
DB_PORT=3306
API_PORT=3000
7 changes: 7 additions & 0 deletions backend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Database connection - App
DB_DATABASE=healthnest-db
DB_HOST=localhost
DB_PASSWORD=hel#net191
DB_USER=healthnest
DB_PORT=3306
API_PORT=3000
3 changes: 2 additions & 1 deletion backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ const dotenv = require("dotenv");

// Load environment variables from .env file
dotenv.config();

console.log("API_PORT " + process.env.API_PORT);
const app = express();
const port = process.env.API_PORT || 4000;


app.use(cors());
app.use(express.json());

Expand Down
43 changes: 22 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
version: '3.8'

services:
frontend:
image: enblitztechnologies/healthnest:frontend
# image: enblitztechnologies/healthnest:frontend
build:
context: frontend
container_name: healthnest-frontend
ports:
- "8000:3000"
- "3000:3000"
depends_on:
- backend
networks:
- healthnest-network
environment:
- REACT_APP_BACKEND_URL=http://healthnest-backend:8081
- WEBSOCKET_URL=ws://healthnest-backend:8081/ws

- REACT_APP_BACKEND_URL=http://localhost:8081
- WEBSOCKET_URL=ws://localhost:8081/ws
backend:
# image: enblitztechnologies/healthnest:backend
image: enblitztechnologies/healthnest:backend
# image: enblitztechnologies/healthnest:backend
build:
context: backend
container_name: healthnest-backend
ports:
- "8081:8081"
- "3000:3000"
depends_on:
mysql:
condition: service_healthy
environment:
DB_HOST: ${DB_HOST}
DB_USER: ${MYSQL_USER}
DB_PASSWORD: ${MYSQL_PASSWORD}
DB_DATABASE: ${MYSQL_DATABASE}
DB_PORT: ${DB_PORT}
DB_HOST: localhost
DB_USER: healthnest
DB_PASSWORD: hel#net191
DB_DATABASE: healthnest-db
DB_PORT: 3306
API_PORT: 3000
networks:
- healthnest-network
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:8081/ || exit 1" ]
test: [ "CMD-SHELL", "curl -f http://localhost:3000/ || exit 1" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
command: [ "sh", "-c", "sleep 20 && npm start" ]

mysql:
image: enblitztechnologies/healthnest:mysql
container_name: healthnest-mysql
ports:
- "3306:3306" # Change this line to avoid port conflict
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
DB_PORT: ${DB_PORT}
MYSQL_DATABASE: healthnest-db
MYSQL_USER: healthnest
MYSQL_PASSWORD: hel#net191
MYSQL_ROOT_PASSWORD: root123
DB_PORT: 3306
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
Expand Down
6 changes: 6 additions & 0 deletions frontend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Port
PORT=8081
API_PORT=8081
# Frontned
BASE_URL="http://localhost:8081"
API_URL="http://localhost:3000"
6 changes: 6 additions & 0 deletions frontend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Port
PORT=8081
API_PORT=8081
# Frontned
BASE_URL="http://localhost:8081"
API_URL="http://localhost:8081"
3 changes: 2 additions & 1 deletion frontend/src/config.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const BASE_URL = "http://localhost:4000";
export const BASE_URL = "http://localhost:3000";

0 comments on commit 7022ce4

Please sign in to comment.