Skip to content

Commit

Permalink
fix: replace boot service with env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
migtarx committed Jul 29, 2024
1 parent 1bdc20d commit 63ba507
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
runs-on: [self-hosted, linux, x64, "${{ github.event.inputs.start_env }}"]
steps:
- name: ${{ github.event.inputs.start_env }} app start
run: PORT=${{ secrets.PORT }} STATUS_SERVER_IP=${{ secrets.STATUS_SERVER_IP }} FF_URL=${{ secrets.FF_URL }} FF_PASWD=${{ secrets.FF_PASWD }} pm2 start npm --name "BLOG" -- start --log-date-format 'DD-MM-YYYY HH:mm:ss'
run: ENV=${{ secrets.ENV }} PORT=${{ secrets.PORT }} STATUS_SERVER_IP=${{ secrets.STATUS_SERVER_IP }} FF_URL=${{ secrets.FF_URL }} FF_PASWD=${{ secrets.FF_PASWD }} pm2 start npm --name "BLOG" -- start --log-date-format 'DD-MM-YYYY HH:mm:ss'
4 changes: 1 addition & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const helmet = require('helmet');
const Falconflare = require('@mpuertadev/falconflare-client');
const app = express();
const { assignId, skipStatics, skipStatusServer } = require('./middlewares/morgan');
const BootService = require('./services/boot.service');
const execMode = BootService.getExecutionMode();
const PORT = process.env.PORT || 3000;

app.use(express.json())
Expand All @@ -27,7 +25,7 @@ app.use(async function getLocation(req, res, next) {
const ffclient = new Falconflare({serverUrl: process.env.FF_URL, accessKey: process.env.FF_PASSWD})
let ipData;
try {
const ip = global.exec_mode == "pro" ? req.headers['x-real-ip'] : req.ip;
const ip = process.env.ENV == "prod" ? req.headers['x-real-ip'] : req.ip;
data = await ffclient.getIpData(ip);
} catch (error) {
console.error('Error fetching IP location:', error);
Expand Down
22 changes: 0 additions & 22 deletions src/services/boot.service.js

This file was deleted.

0 comments on commit 63ba507

Please sign in to comment.