Skip to content

Commit

Permalink
fix(app-service): distinct & add runtime version & image;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Dec 7, 2021
1 parent 6ac01d8 commit e2a6559
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
13 changes: 10 additions & 3 deletions packages/app-service/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as path from 'path'
import * as dotenv from 'dotenv'
import { readFileSync } from 'fs'

/**
* parse environment vars from the `.env` file if existing
Expand Down Expand Up @@ -107,11 +108,17 @@ export default class Config {
return (process.env.FUNCTION_LOG_EXPIRED_TIME ?? 3600 * 24 * 30) as number
}

static get RUNTIME_VERSION(): number {
return process.env.RUNTIME_VERSION as any as number
static get RUNTIME_IMAGE(): string {
return process.env.RUNTIME_IMAGE
}

static get RUNTIME_VERSION(): string {
return require('../package.json')?.version
}

static get APP_ID(): string {
return process.env.APP_ID
}
}
}


5 changes: 3 additions & 2 deletions packages/app-service/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-07-30 10:30:29
* @LastEditTime: 2021-12-07 13:13:40
* @LastEditTime: 2021-12-07 13:32:26
* @Description:
*/

Expand All @@ -25,6 +25,7 @@ router.use('/health-check', (_req, res) => {
}
return res.send({
APP_ID: Config.APP_ID,
RUNTIME_VERSION: Config.RUNTIME_VERSION
RUNTIME_VERSION: Config.RUNTIME_VERSION,
RUNTIME_IMAGE: Config.RUNTIME_IMAGE
})
})
2 changes: 1 addition & 1 deletion packages/system-server/src/lib/service-driver/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class DockerContainerServiceDriver {
`SERVER_SECRET_SALT=${app.config.server_secret_salt}`,
`FLAGS=--max_old_space_size=${max_old_space_size}`,
`APP_ID=${app.appid}`,
`RUNTIME_VERSION=${app.runtime?.image}`
`RUNTIME_IMAGE=${app.runtime?.image}`
],
ExposedPorts: {
"8000/tcp": {}
Expand Down

0 comments on commit e2a6559

Please sign in to comment.