@briancray/belte 0.8.1 → 0.9.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.
@@ -29,17 +29,23 @@ import { loadEnvFromBinaryDir } from './lib/cli/loadEnvFromBinaryDir.ts'
29
29
  import { createServer } from './lib/server/runtime/createServer.ts'
30
30
  import { requestContext } from './lib/server/runtime/requestContext.ts'
31
31
  import { loadEnvFromDataDir } from './lib/shared/loadEnvFromDataDir.ts'
32
+ import { runningAsStandaloneBinary } from './lib/shared/runningAsStandaloneBinary.ts'
32
33
  import { setCacheStoreResolver } from './lib/shared/setCacheStoreResolver.ts'
33
34
 
34
35
  /*
35
36
  Resolve config into process.env before anything reads it (createServer reads
36
- PORT, app code reads Bun.env.*). Data-dir first so the user's saved config wins
37
- over the binary-dir shipped default; both back-fill only what the shell or Bun's
38
- CWD `.env` didn't already set. A bundle launched via `open` has cwd `/`, so the
39
- data-dir `.env` is how it gets its config at all.
37
+ PORT, app code reads Bun.env.*). Standalone-only: data-dir first so the user's
38
+ saved config wins over the binary-dir shipped default; both back-fill only what
39
+ the shell didn't already set. A bundle launched via `open` has cwd `/`, so the
40
+ data-dir `.env` is how it gets its config at all. Under `bun dev`/`bun start`
41
+ these bundle layers don't apply — the project's own CWD `.env` (Bun-autoloaded)
42
+ is the config — so loading them would let a stray data-dir `PORT` defeat dev's
43
+ port scan.
40
44
  */
41
- await loadEnvFromDataDir(cliProgramName)
42
- await loadEnvFromBinaryDir()
45
+ if (runningAsStandaloneBinary()) {
46
+ await loadEnvFromDataDir(cliProgramName)
47
+ await loadEnvFromBinaryDir()
48
+ }
43
49
 
44
50
  // In a bundle, tie this server's life to the launcher's (no-op standalone).
45
51
  exitWithParent()