velocious 1.0.91 → 1.0.92
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,30 +1,7 @@
|
|
|
1
|
-
import Application from "../../application.js"
|
|
2
1
|
import BaseCommand from "../base-command.js"
|
|
3
2
|
|
|
4
3
|
export default class VelociousCliCommandsServer extends BaseCommand{
|
|
5
4
|
async execute() {
|
|
6
|
-
|
|
7
|
-
this.newConfiguration = Object.assign({}, this.databasePool.getConfiguration())
|
|
8
|
-
this.databaseConnection = await this.databasePool.spawnConnectionWithConfiguration(this.newConfiguration)
|
|
9
|
-
|
|
10
|
-
await this.databaseConnection.connect()
|
|
11
|
-
|
|
12
|
-
const {parsedProcessArgs} = this.args
|
|
13
|
-
const host = parsedProcessArgs.h || parsedProcessArgs.host || "127.0.0.1"
|
|
14
|
-
const port = parsedProcessArgs.p || parsedProcessArgs.port || 3006
|
|
15
|
-
const application = new Application({
|
|
16
|
-
configuration: this.getConfiguration(),
|
|
17
|
-
httpServer: {
|
|
18
|
-
host,
|
|
19
|
-
port
|
|
20
|
-
},
|
|
21
|
-
type: "server"
|
|
22
|
-
})
|
|
23
|
-
const environment = this.getConfiguration().getEnvironment()
|
|
24
|
-
|
|
25
|
-
await application.initialize()
|
|
26
|
-
await application.startHttpServer()
|
|
27
|
-
console.log(`Started Velocious HTTP server on ${host}:${port} in ${environment} environment`)
|
|
28
|
-
await application.wait()
|
|
5
|
+
return await this.getConfiguration().getEnvironmentHandler().cliCommandsServer(this)
|
|
29
6
|
}
|
|
30
7
|
}
|
|
@@ -31,6 +31,10 @@ export default class VelociousEnvironmentsHandlerBrowser extends Base {
|
|
|
31
31
|
throw new Error("Unsupported on browser")
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
async cliCommandsServer(_command) { // eslint-disable-line no-unused-vars
|
|
35
|
+
throw new Error("Unsupported on browser")
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
async cliCommandsTest(_command) { // eslint-disable-line no-unused-vars
|
|
35
39
|
throw new Error("Unsupported on browser")
|
|
36
40
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Application from "../../../../application.js"
|
|
2
|
+
import BaseCommand from "../../../../cli/base-command.js"
|
|
3
|
+
|
|
4
|
+
export default class VelociousCliCommandsServer extends BaseCommand{
|
|
5
|
+
async execute() {
|
|
6
|
+
this.databasePool = this.getConfiguration().getDatabasePool()
|
|
7
|
+
this.newConfiguration = Object.assign({}, this.databasePool.getConfiguration())
|
|
8
|
+
this.databaseConnection = await this.databasePool.spawnConnectionWithConfiguration(this.newConfiguration)
|
|
9
|
+
|
|
10
|
+
await this.databaseConnection.connect()
|
|
11
|
+
|
|
12
|
+
const {parsedProcessArgs} = this.args
|
|
13
|
+
const host = parsedProcessArgs.h || parsedProcessArgs.host || "127.0.0.1"
|
|
14
|
+
const port = parsedProcessArgs.p || parsedProcessArgs.port || 3006
|
|
15
|
+
const application = new Application({
|
|
16
|
+
configuration: this.getConfiguration(),
|
|
17
|
+
httpServer: {
|
|
18
|
+
host,
|
|
19
|
+
port
|
|
20
|
+
},
|
|
21
|
+
type: "server"
|
|
22
|
+
})
|
|
23
|
+
const environment = this.getConfiguration().getEnvironment()
|
|
24
|
+
|
|
25
|
+
await application.initialize()
|
|
26
|
+
await application.startHttpServer()
|
|
27
|
+
console.log(`Started Velocious HTTP server on ${host}:${port} in ${environment} environment`)
|
|
28
|
+
await application.wait()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -3,6 +3,7 @@ import CliCommandsDestroyMigration from "./node/cli/commands/destroy/migration.j
|
|
|
3
3
|
import CliCommandsInit from "./node/cli/commands/init.js"
|
|
4
4
|
import CliCommandsGenerateMigration from "./node/cli/commands/generate/migration.js"
|
|
5
5
|
import CliCommandsGenerateModel from "./node/cli/commands/generate/model.js"
|
|
6
|
+
import CliCommandsServer from "./node/cli/commands/server.js"
|
|
6
7
|
import CliCommandsTest from "./node/cli/commands/test.js"
|
|
7
8
|
import {dirname} from "path"
|
|
8
9
|
import {fileURLToPath} from "url"
|
|
@@ -63,6 +64,10 @@ export default class VelociousEnvironmentHandlerNode extends Base{
|
|
|
63
64
|
return await this.forwardCommand(command, CliCommandsGenerateModel)
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
async cliCommandsServer(command) {
|
|
68
|
+
return await this.forwardCommand(command, CliCommandsServer)
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
async cliCommandsTest(command) {
|
|
67
72
|
return await this.forwardCommand(command, CliCommandsTest)
|
|
68
73
|
}
|