Skip to content

Commit

Permalink
feat: modify config in production mode (#5)
Browse files Browse the repository at this point in the history
* feat: modify config in production mode

* chore: limit action repertory
  • Loading branch information
leo220yuyaodog authored Mar 21, 2024
1 parent b7e361f commit b078e90
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
build:
# if: github.repository == 'casvisor/dbgate' && github.event_name == 'push'
if: github.repository == 'casvisor/dbgate' && github.event_name == 'push'
runs-on: ${{ matrix.os }}

strategy:
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,26 @@ function start() {
app.use(getExpressPath('/runners/data'), express.static(rundir()));

if (platformInfo.isDocker) {
const port = process.env.PORT || 3000;
const port = process.env.PORT || 19500;
logger.info(`DbGate API listening on port ${port} (docker build)`);
server.listen(port);
} else if (platformInfo.isNpmDist) {
getPort({
port: parseInt(
// @ts-ignore
process.env.PORT || 3000
process.env.PORT || 19500
),
}).then(port => {
server.listen(port, () => {
logger.info(`DbGate API listening on port ${port} (NPM build)`);
});
});
} else if (process.env.DEVWEB) {
const port = process.env.PORT || 3000;
const port = process.env.PORT || 19500;
logger.info(`DbGate API & web listening on port ${port} (dev web build)`);
server.listen(port);
} else {
const port = process.env.PORT || 3000;
const port = process.env.PORT || 19500;
logger.info(`DbGate API listening on port ${port} (dev API build)`);
server.listen(port);
}
Expand Down
1 change: 1 addition & 0 deletions packages/web/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_URL=http://localhost:19000/dbgate
5 changes: 3 additions & 2 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "dbgate-web",
"version": "5.0.0-alpha.1",
"license": "MIT",
"scripts": {
"build": "rollup -c",
"dev": "cross-env API_URL=http://localhost:3000 rollup -c -w",
"build": "cross-env NODE_ENV=production rollup -c",
"dev": "cross-env NODE_ENV=development rollup -c -w",
"start": "sirv public --port 5001",
"validate": "svelte-check",
"prepublishOnly": "yarn build"
Expand Down
2 changes: 2 additions & 0 deletions packages/web/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import css from 'rollup-plugin-css-only';
import { config } from 'dotenv'
config({ path: ".env"}).parsed

const production = !process.env.ROLLUP_WATCH;

Expand Down

0 comments on commit b078e90

Please sign in to comment.