Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/node-env #25

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .github/workflows/deploy_to_azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,10 @@ jobs:
npm ci
npm run build --if-present

- name: Test
run: |
echo "ls -l"
ls -l
echo "ls -l frontend/dist/frontend"
ls -l frontend/dist/frontend
echo "ls -l backend/dist"
ls -l backend/dist
echo "Test"

- name: Install raw dependencies for backend
run: |
cd ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
ls -la
npm install
npm ci --production

- name: "Deploy to Azure Web App"
id: deploy-to-webapp
Expand Down
10 changes: 5 additions & 5 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
"format": "prettier --write \"src/**/*.ts\"",
"lint": "eslint ./src --ext .ts",
"lint:fix": "eslint ./src --ext .ts --fix",
"postbuild": "cpx package.json dist",
"start": "npm run build && node --env-file .env dist/main.js",
"postbuild": "cpx package.json dist && cpx package-lock.json dist",
"start": "npm run build && node dist/main.js",
"serve": "node dist/main.js",
"serve:env": "node --env-file .env dist/main.js",
"test": "jest --config=jest.config.cjs"
},
"dependencies": {
"ace-builds": "~1.33.1",
"body-parser": "~1.20.2",
"cookie-session": "~2.1.0",
"cors": "~2.8.5",
"dotenv": "^16.4.5",
"express": "~4.19.2",
"socket.io": "~4.7.5",
"socket.io-client": "~4.7.5",
Expand All @@ -57,9 +57,9 @@
"rimraf": "~5.0.7",
"source-map-support": "~0.5.21",
"ts-jest": "~29.1.2",
"ts-jest-mock-import-meta": "^1.2.0",
"typescript": "~5.4.5",
"winston": "~3.13.0",
"ts-jest-mock-import-meta": "^1.2.0"
"winston": "~3.13.0"
},
"type": "module",
"author": "Myonara",
Expand Down
4 changes: 4 additions & 0 deletions backend/src/core/environment/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { IEnvironment } from './types/environment.js';
import { getEnvironmentVariable } from './utils/get-environment-variable.js';
import { resolveModulePath } from './utils/resolve-modulepath.js';

import { config as configureEnvironment } from 'dotenv';

/**
* Environment class to handle environment variables and application settings.
* Reads the environment variables once oppon initialisation and provides them as properties.
Expand All @@ -24,6 +26,8 @@ export class Environment implements IEnvironment {
* Initializes the environment variables.
*/
private constructor() {
configureEnvironment();

const tls_cert = getEnvironmentVariable('TLS_CERT', false);

const tls_key = getEnvironmentVariable('TLS_KEY', false);
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const mudConfig = loadConfig(

logger.info('[Main] Mud Config loaded', { mudConfig });

const port = process.env.PORT || 3000;
const port = process.env.PORT || 5000;

const app = express();

Expand Down
6 changes: 1 addition & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"name": "@webmud3/frontend",
"version": "1.0.0-alpha",
"description": "Webmud3 Frontend",
"engines": {
"node": "20.12.2"
},
"scripts": {
"format": "prettier --write \"src/**/*.ts\"",
"no-prepare": "npm run build",
"no-prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
.mud-output {
flex: 0 1 100%;

min-height: 400px;
overflow-x: auto;
overflow-y: auto;
flex-direction: column;
Expand Down
15 changes: 13 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"build": "npm run build --workspaces",
"integrate-client": "ncp frontend/dist/frontend backend/dist/wwwroot",
"postbuild": "npm run integrate-client",
"start": "npm run build && npm run serve:env --workspace backend",
"start": "npm run build && npm run serve --workspace backend",
"test": "npm run test --workspaces",
"lint": "npm run lint --workspaces"
"lint": "npm run lint --workspaces",
"build:experimantal:prod": "npm run build --workspace frontend -- --configuration=production && npm run build --workspace backend"
},
"devDependencies": {
"cpx": "~1.5.0",
"ncp": "^2.0.0"
"ncp": "~2.0.0"
}
}
Loading