updated env and yml files*
This commit is contained in:
parent
c61a15c0ce
commit
49052dbeec
11 changed files with 246 additions and 16 deletions
2
.cursorignore
Normal file
2
.cursorignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
!.env
|
||||
!.env.*
|
||||
34
.env.dev
Normal file
34
.env.dev
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Development Environment Configuration
|
||||
# Frontend Nyla - Development
|
||||
|
||||
# API Configuration
|
||||
VITE_API_BASE_URL="http://localhost:8000/"
|
||||
VITE_API_TIMEOUT=10000
|
||||
|
||||
# Microsoft Entra ID Configuration
|
||||
VITE_MICROSOFT_CLIENT_ID=24cd6c8a-b592-4905-a5ba-d5fa9f911154
|
||||
VITE_MICROSOFT_TENANT_ID=6a51aaeb-2467-4186-9504-2a05aedc591f
|
||||
VITE_ENTRA_CLIENT_SECRET=2iw8Q~jwqG1iacxHopBt5pstu6R45UC1gIQabcbD
|
||||
VITE_ENTRA_AUTHORITY=https://login.microsoftonline.com/6a51aaeb-2467-4186-9504-2a05aedc591f
|
||||
VITE_ENTRA_REDIRECT_PATH=/auth/callback/
|
||||
VITE_ENTRA_REDIRECT_URI=http://localhost:8000/api/msft/auth/callback/
|
||||
|
||||
# Application Configuration
|
||||
VITE_APP_NAME=PowerOn Nyla dev
|
||||
VITE_APP_VERSION=0.0.0
|
||||
VITE_APP_ENVIRONMENT=development
|
||||
|
||||
# Debug Configuration
|
||||
VITE_DEBUG=true
|
||||
VITE_LOG_LEVEL=debug
|
||||
VITE_ENABLE_CONSOLE_LOGS=true
|
||||
|
||||
# Feature Flags
|
||||
VITE_ENABLE_ANALYTICS=false
|
||||
VITE_ENABLE_ERROR_REPORTING=false
|
||||
VITE_ENABLE_PERFORMANCE_MONITORING=false
|
||||
|
||||
# Development Server
|
||||
VITE_DEV_SERVER_PORT=5176
|
||||
VITE_DEV_SERVER_HOST=localhost
|
||||
VITE_DEV_SERVER_HTTPS=false
|
||||
33
.env.int
Normal file
33
.env.int
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Integration/Test Environment Configuration
|
||||
# Frontend Nyla - Integration
|
||||
|
||||
# API Configuration
|
||||
VITE_API_BASE_URL=https://gateway-int.poweron-center.net
|
||||
VITE_API_TIMEOUT=12000
|
||||
|
||||
# Microsoft Entra ID Configuration
|
||||
VITE_MICROSOFT_CLIENT_ID=24cd6c8a-b592-4905-a5ba-d5fa9f911154
|
||||
VITE_MICROSOFT_TENANT_ID=6a51aaeb-2467-4186-9504-2a05aedc591f
|
||||
VITE_ENTRA_CLIENT_SECRET=2iw8Q~jwqG1iacxHopBt5pstu6R45UC1gIQabcbD
|
||||
VITE_ENTRA_AUTHORITY=https://login.microsoftonline.com/6a51aaeb-2467-4186-9504-2a05aedc591f
|
||||
VITE_ENTRA_REDIRECT_PATH=/auth/callback/
|
||||
VITE_ENTRA_REDIRECT_URI=https://gateway-int.poweron-center.net/api/msft/auth/callback/
|
||||
|
||||
# Application Configuration
|
||||
VITE_APP_NAME=Poweron Nyla int
|
||||
VITE_APP_VERSION=0.0.0
|
||||
VITE_APP_ENVIRONMENT=integration
|
||||
|
||||
# Debug Configuration
|
||||
VITE_DEBUG=true
|
||||
VITE_LOG_LEVEL=info
|
||||
VITE_ENABLE_CONSOLE_LOGS=true
|
||||
|
||||
# Feature Flags
|
||||
VITE_ENABLE_ANALYTICS=true
|
||||
VITE_ENABLE_ERROR_REPORTING=true
|
||||
VITE_ENABLE_PERFORMANCE_MONITORING=true
|
||||
|
||||
# Test Configuration
|
||||
VITE_ENABLE_MOCK_DATA=false
|
||||
VITE_ENABLE_TEST_MODE=true
|
||||
33
.env.prod
Normal file
33
.env.prod
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Production Environment Configuration
|
||||
# Frontend Nyla - Production
|
||||
|
||||
# API Configuration
|
||||
VITE_API_BASE_URL=https://gateway-prod.poweron-center.net
|
||||
VITE_API_TIMEOUT=15000
|
||||
|
||||
# Microsoft Entra ID Configuration
|
||||
VITE_MICROSOFT_CLIENT_ID=24cd6c8a-b592-4905-a5ba-d5fa9f911154
|
||||
VITE_MICROSOFT_TENANT_ID=6a51aaeb-2467-4186-9504-2a05aedc591f
|
||||
VITE_ENTRA_CLIENT_SECRET=2iw8Q~jwqG1iacxHopBt5pstu6R45UC1gIQabcbD
|
||||
VITE_ENTRA_AUTHORITY=https://login.microsoftonline.com/6a51aaeb-2467-4186-9504-2a05aedc591f
|
||||
VITE_ENTRA_REDIRECT_PATH=/auth/callback/
|
||||
VITE_ENTRA_REDIRECT_URI=https://gateway-prod.poweron-center.net/api/msft/auth/callback/
|
||||
|
||||
# Application Configuration
|
||||
VITE_APP_NAME=PowerOn Nyla
|
||||
VITE_APP_VERSION=0.0.0
|
||||
VITE_APP_ENVIRONMENT=production
|
||||
|
||||
# Debug Configuration
|
||||
VITE_DEBUG=false
|
||||
VITE_LOG_LEVEL=error
|
||||
VITE_ENABLE_CONSOLE_LOGS=false
|
||||
|
||||
# Feature Flags
|
||||
VITE_ENABLE_ANALYTICS=true
|
||||
VITE_ENABLE_ERROR_REPORTING=true
|
||||
VITE_ENABLE_PERFORMANCE_MONITORING=true
|
||||
|
||||
# Security Configuration
|
||||
VITE_ENABLE_HTTPS=true
|
||||
VITE_ENABLE_CSP=true
|
||||
66
.github/workflows/poweron_nyla_int.yml
vendored
Normal file
66
.github/workflows/poweron_nyla_int.yml
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
name: Deploy Nyla Frontend to Integration
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- int
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Copy integration environment file
|
||||
run: |
|
||||
cp .env.int .env
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
npm install express
|
||||
|
||||
- name: Build React app for integration
|
||||
run: npm run build:int
|
||||
|
||||
- name: Prepare deployment package
|
||||
run: |
|
||||
# Create deployment package with build files and necessary configs
|
||||
mkdir deploy
|
||||
cp -r dist/* deploy/
|
||||
# Create a simple server.js for serving the app
|
||||
echo "const express = require('express');" > deploy/server.js
|
||||
echo "const path = require('path');" >> deploy/server.js
|
||||
echo "const app = express();" >> deploy/server.js
|
||||
echo "app.use(express.static(path.join(__dirname)));" >> deploy/server.js
|
||||
echo "app.get('/*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); });" >> deploy/server.js
|
||||
echo "const port = process.env.PORT || 8080;" >> deploy/server.js
|
||||
echo "app.listen(port, () => console.log('Server running on port', port));" >> deploy/server.js
|
||||
# Create a new package.json for deployment
|
||||
echo '{
|
||||
"name": "frontend-int",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
}
|
||||
}' > deploy/package.json
|
||||
|
||||
- name: 'Deploy to Azure Web App'
|
||||
uses: azure/webapps-deploy@v3
|
||||
with:
|
||||
app-name: 'poweron-nyla-int'
|
||||
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_POWERON_NYLA_INT }}
|
||||
package: ./deploy
|
||||
66
.github/workflows/poweron_nyla_main.yml
vendored
Normal file
66
.github/workflows/poweron_nyla_main.yml
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
name: Deploy Nyla Frontend to Production
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Copy production environment file
|
||||
run: |
|
||||
cp .env.prod .env
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
npm install express
|
||||
|
||||
- name: Build React app for production
|
||||
run: npm run build:prod
|
||||
|
||||
- name: Prepare deployment package
|
||||
run: |
|
||||
# Create deployment package with build files and necessary configs
|
||||
mkdir deploy
|
||||
cp -r dist/* deploy/
|
||||
# Create a simple server.js for serving the app
|
||||
echo "const express = require('express');" > deploy/server.js
|
||||
echo "const path = require('path');" >> deploy/server.js
|
||||
echo "const app = express();" >> deploy/server.js
|
||||
echo "app.use(express.static(path.join(__dirname)));" >> deploy/server.js
|
||||
echo "app.get('/*', function(req, res) { res.sendFile(path.join(__dirname, 'index.html')); });" >> deploy/server.js
|
||||
echo "const port = process.env.PORT || 8080;" >> deploy/server.js
|
||||
echo "app.listen(port, () => console.log('Server running on port', port));" >> deploy/server.js
|
||||
# Create a new package.json for deployment
|
||||
echo '{
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
}
|
||||
}' > deploy/package.json
|
||||
|
||||
- name: 'Deploy to Azure Web App'
|
||||
uses: azure/webapps-deploy@v3
|
||||
with:
|
||||
app-name: 'poweron-nyla'
|
||||
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_POWERON_NYLA }}
|
||||
package: ./deploy
|
||||
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -22,13 +22,3 @@ dist-ssr
|
|||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
<<<<<<< Updated upstream
|
||||
.env.*.local
|
||||
=======
|
||||
.env.*.local
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React + TS</title>
|
||||
<title>%VITE_APP_NAME%</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@
|
|||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --port 5176",
|
||||
"dev": "vite --port 5176 --mode dev",
|
||||
"dev:prod": "vite --port 5176 --mode prod",
|
||||
"dev:int": "vite --port 5176 --mode int",
|
||||
"build": "tsc -b && vite build",
|
||||
"build:prod": "tsc -b && vite build --mode prod",
|
||||
"build:int": "tsc -b && vite build --mode int",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,8 +15,13 @@ import Home from './pages/Home/Home';
|
|||
import './assets/styles/light.css';
|
||||
|
||||
function App() {
|
||||
// Load saved theme preference on app mount
|
||||
// Load saved theme preference and set app name on app mount
|
||||
useEffect(() => {
|
||||
// Set app name globally
|
||||
const appName = import.meta.env.VITE_APP_NAME || "PowerOn";
|
||||
document.title = appName;
|
||||
|
||||
// Load saved theme preference
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
const prefersDark = savedTheme === 'dark' || (!savedTheme && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ import PageManager from '../../components/PageManager';
|
|||
|
||||
|
||||
function Home () {
|
||||
useEffect(()=> {
|
||||
document.title = "PowerOn";
|
||||
}, []);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue