@ti-engine/core 1.11.1 → 1.12.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  This document contains the list of changes made to the framework. The format is based on the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
4
4
 
5
+ ## Version 1.12.0
6
+
7
+ * feat(start-instance): report which `.env` file was loaded, or that none was found at the resolved path, at `DEBUG`.
8
+ The path is derived from `process.cwd()`, and a missing file is deliberately not fatal — a container legitimately
9
+ supplies its whole environment directly. But the two cases were indistinguishable: an instance started from a
10
+ different working directory (an IDE run configuration, a wrapper script) read no env file at all, and every
11
+ setting it carried was simply absent. That surfaces much later as behaviour nobody configured — an empty
12
+ allowlist, an unset secret — with nothing linking it back to a file that was never read. The outcome is logged
13
+ just after the logger becomes available, since loading the logger any earlier would pull in configuration that
14
+ reads `process.env`.
15
+
5
16
  ## Version 1.11.1
6
17
 
7
18
  License change only — no functional code changed.
@@ -40,8 +40,16 @@ const envFilePath = ( () => {
40
40
 
41
41
  // Load the resolved .env file using the native Node loader (Node >= 20.12). A missing file is not fatal —
42
42
  // environment variables may be supplied entirely by the OS/container. Existing process.env values are NOT overridden.
43
+ //
44
+ // Whether it was found is recorded rather than discarded. The path is derived from process.cwd(), so an instance
45
+ // started from a different working directory — an IDE run configuration, a wrapper script — silently reads no env
46
+ // file at all, and every setting it carried is simply absent. That surfaces much later as behaviour nobody
47
+ // configured, with nothing linking it back to the file that was never read. The logger cannot be required yet
48
+ // (loading it pulls in configuration that reads process.env), so the outcome is logged a few lines down.
49
+ let envFileLoaded = false;
43
50
  try {
44
51
  process.loadEnvFile( envFilePath );
52
+ envFileLoaded = true;
45
53
  } catch ( error ) {
46
54
  if ( error.code !== "ENOENT" ) {
47
55
  throw error;
@@ -51,6 +59,10 @@ try {
51
59
  const tools = require( "#tools" );
52
60
  const logger = require( "#logger" );
53
61
 
62
+ logger.log( envFileLoaded
63
+ ? `Loaded environment variables from '${ envFilePath }'.`
64
+ : `No environment file at '${ envFilePath }' — continuing with the environment as supplied. If settings you expected are missing, check the working directory this instance was started from.`, logger.logSeverity.DEBUG );
65
+
54
66
  // Configure the current instance variables before requiring any platform modules and store the necessary ones in memory cache:
55
67
  process.env.TI_INSTANCE_ID = "ti-" + tools.getUUID();
56
68
  process.env.TI_INSTANCE_CLASS = process.env.TI_INSTANCE_CLASS || "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ti-engine/core",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "description": "Microservice framework for Node.js: a Redis-backed message exchange with end-to-end call tracing, retries and tamper-evident message envelopes.",
5
5
  "keywords": [
6
6
  "microservices",