@thzero/library_server 0.16.1 → 0.16.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.
Files changed (2) hide show
  1. package/boot/index.js +46 -19
  2. package/package.json +2 -2
package/boot/index.js CHANGED
@@ -54,13 +54,13 @@ class BootMain {
54
54
  const plugins = this._determinePlugins(args);
55
55
  await await this._initPlugins(plugins);
56
56
 
57
- this.ip = this._appConfig.get('ip', null);
58
- this.loggerServiceI.info2(`config.ip.override: ${this.ip}`);
59
- this.port = this._appConfig.get('port');
60
- this.loggerServiceI.info2(`config.port.override: ${this.port}`);
61
- this.loggerServiceI.info2(`process.env.PORT: ${process.env.PORT}`);
62
- this.port = process.env.PORT || this.port;
63
- this.loggerServiceI.info2(`selected.port: ${this.port}`);
57
+ // this.ip = this._appConfig.get('ip', null);
58
+ // this.loggerServiceI.info2(`config.ip.override: ${this.ip}`);
59
+ // this.port = this._appConfig.get('port');
60
+ // this.loggerServiceI.info2(`config.port.override: ${this.port}`);
61
+ // this.loggerServiceI.info2(`process.env.PORT: ${process.env.PORT}`);
62
+ // this.port = process.env.PORT || this.port;
63
+ // this.loggerServiceI.info2(`selected.port: ${this.port}`);
64
64
 
65
65
  const results = await this._initApp(args, plugins);
66
66
 
@@ -109,6 +109,43 @@ class BootMain {
109
109
  };
110
110
 
111
111
  createTerminus(results.server, terminusOptions);
112
+
113
+ // const self = this;
114
+ // const listen = async (port, address) => new Promise((resolve, reject) => {
115
+ // self._initAppListen(results.app, results.server, address, port, (err) => {
116
+ // if (err) {
117
+ // reject(err);
118
+ // return;
119
+ // }
120
+
121
+ // resolve();
122
+ // });
123
+ // });
124
+ // await listen(this.port, this.ip);
125
+ // this.address = results.server.address() ? results.server.address().address : null;
126
+ // if (this.address === '::')
127
+ // this.address = await internalIpV4();
128
+
129
+ await this._initServer(results.server);
130
+
131
+ for (const [key, value] of this._servicesPost) {
132
+ console.log(`services.init.post - ${key}`);
133
+ if (value.initPost)
134
+ await value.initPost();
135
+ }
136
+ this._initAppPost(results.app, args);
137
+
138
+ await this._initServerDiscovery(results.server);
139
+
140
+ console.log();
141
+ this.ip = this._appConfig.get('ip', null);
142
+ console.log(`config.ip.override: ${this.ip}`);
143
+ this.port = this._appConfig.get('port');
144
+ console.log(`config.port.override: ${this.port}`);
145
+ console.log(`process.env.PORT: ${process.env.PORT}`);
146
+ this.port = process.env.PORT || this.port;
147
+ console.log(`selected.port: ${this.port}`);
148
+ console.log();
112
149
 
113
150
  const self = this;
114
151
  const listen = async (port, address) => new Promise((resolve, reject) => {
@@ -126,18 +163,8 @@ class BootMain {
126
163
  if (this.address === '::')
127
164
  this.address = await internalIpV4();
128
165
 
129
- await this._initServer(results.server);
130
-
131
- for (const [key, value] of this._servicesPost) {
132
- console.log(`services.init.post - ${key}`);
133
- if (value.initPost)
134
- await value.initPost();
135
- }
136
- this._initAppPost(results.app, args);
137
-
138
- await this._initServerDiscovery(results.server);
139
-
140
- this.loggerServiceI.info2(`Starting HTTP on: `, this.address);
166
+ console.log();
167
+ console.log(`Starting HTTP on: ${this.address}:${this.port}`);
141
168
  }
142
169
 
143
170
  async _initApp(args, plugins) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@thzero/library_server",
3
3
  "type": "module",
4
- "version": "0.16.1",
4
+ "version": "0.16.2",
5
5
  "version_major": 0,
6
6
  "version_minor": 16,
7
- "version_patch": 1,
7
+ "version_patch": 2,
8
8
  "version_date": "08/28/2022",
9
9
  "description": "An opinionated library of common functionality to bootstrap an API application using MongoDb and Firebase. Currently either Fastify or Koa can be used as the web server.",
10
10
  "author": "thZero",