@omen.foundation/node-microservice-runtime 0.1.83 → 0.1.84

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@omen.foundation/node-microservice-runtime",
3
- "version": "0.1.83",
3
+ "version": "0.1.84",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -61,7 +61,8 @@ async function main() {
61
61
 
62
62
  if (args.envFile) {
63
63
  const envPath = path.resolve(args.envFile);
64
- dotenv.config({ path: envPath });
64
+ // Use override: true to ensure .env file values override any existing environment variables
65
+ dotenv.config({ path: envPath, override: true });
65
66
  }
66
67
 
67
68
  if (args.cid) {
@@ -151,7 +151,7 @@ function parseArgs(argv) {
151
151
  }
152
152
  }
153
153
 
154
- if (!args.envFile && process.env.npm_config_env_file) {
154
+ if (process.env.npm_config_env_file) {
155
155
  args.envFile = process.env.npm_config_env_file;
156
156
  }
157
157
 
@@ -981,11 +981,26 @@ ENTRYPOINT ["/beam/service/start.sh"]
981
981
  }
982
982
 
983
983
  async function main() {
984
- const args = parseArgs(process.argv.slice(2));
985
-
986
- if (args.envFile) {
987
- dotenv.config({ path: path.resolve(args.envFile) });
984
+ // Parse --env-file first so we can load .env before parseArgs reads environment variables
985
+ // This ensures .env file values are used instead of stale system environment variables
986
+ const rawArgs = process.argv.slice(2);
987
+ let envFile = undefined;
988
+ for (let i = 0; i < rawArgs.length; i++) {
989
+ if (rawArgs[i] === '--env-file' && i + 1 < rawArgs.length) {
990
+ envFile = rawArgs[i + 1];
991
+ break;
992
+ }
988
993
  }
994
+
995
+ // Load .env file first with override to ensure it takes precedence
996
+ if (envFile) {
997
+ dotenv.config({ path: path.resolve(envFile), override: true });
998
+ } else if (process.env.npm_config_env_file) {
999
+ dotenv.config({ path: path.resolve(process.env.npm_config_env_file), override: true });
1000
+ }
1001
+
1002
+ // Now parse all args - env vars from .env will be available
1003
+ const args = parseArgs(rawArgs);
989
1004
 
990
1005
  const pkg = await readJson(path.resolve('package.json'));
991
1006
  const beamableConfig = pkg.beamable || {};