@lakutata/template-service 3.0.0-beta.0 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Application, type ILogger} from 'lakutata'
|
|
2
|
-
import {
|
|
2
|
+
import {config} from './config/Config.js'
|
|
3
3
|
|
|
4
4
|
Application
|
|
5
|
-
.run(
|
|
5
|
+
.run(config)
|
|
6
6
|
.onLaunched((app: Application, log: ILogger): void => log.info('%s started in %s mode', app.appName, app.mode()))
|
|
7
7
|
.onFatalException((error: Error, log: ILogger): void => log.error('The service cannot start: %s', error.message))
|
|
@@ -15,7 +15,7 @@ import zhCN from '../locales/zh-CN.json' with {type: 'json'}
|
|
|
15
15
|
* The options of the service
|
|
16
16
|
* @param port the port of the HTTP server, the PORT environment variable or 8080 by default
|
|
17
17
|
*/
|
|
18
|
-
export function
|
|
18
|
+
export function config(port: number = Number(process.env.PORT ?? 8080)): ApplicationOptions {
|
|
19
19
|
return {
|
|
20
20
|
id: '{$APP_ID}',
|
|
21
21
|
name: '{$APP_NAME}',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {after, before, describe, it} from 'node:test'
|
|
2
2
|
import assert from 'node:assert'
|
|
3
3
|
import {Application} from 'lakutata'
|
|
4
|
-
import {
|
|
4
|
+
import {config} from '../config/Config.js'
|
|
5
5
|
|
|
6
6
|
const PORT: number = Number(process.env.TEST_PORT ?? 18081)
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ describe('{$APP_NAME}', (): void => {
|
|
|
12
12
|
before(async (): Promise<void> => {
|
|
13
13
|
process.env.API_TOKEN = 'test-token'
|
|
14
14
|
app = await new Promise<Application>((resolve: (app: Application) => void): void => {
|
|
15
|
-
Application.run(
|
|
15
|
+
Application.run(config(PORT)).onLaunched((launched: Application): void => resolve(launched))
|
|
16
16
|
})
|
|
17
17
|
})
|
|
18
18
|
|