You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@platformatic/foundation

Package Overview
Dependencies
Maintainers
9
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/foundation - npm Package Compare versions

Comparing version
3.19.0
to
3.20.0
+30
-20
lib/configuration.js

@@ -343,3 +343,3 @@ import toml from '@iarna/toml'

export async function loadEnv (root, ignoreProcessEnv = false, additionalEnv = {}) {
export async function loadEnv (root, ignoreProcessEnv = false, additionalEnv = {}, customEnvFile = null) {
if (!isAbsolute(root)) {

@@ -349,25 +349,34 @@ root = resolve(process.cwd(), root)

let currentPath = root
const rootPath = parse(root).root
let envFile = customEnvFile
// Search for the .env file in the current directory and its parents
let envFile
while (currentPath !== rootPath) {
const candidate = resolve(currentPath, '.env')
if (await isFileAccessible(candidate)) {
envFile = candidate
break
// If a custom env file is provided, resolve it and check if it exists
if (customEnvFile) {
envFile = isAbsolute(customEnvFile) ? customEnvFile : resolve(root, customEnvFile)
if (!(await isFileAccessible(envFile))) {
throw new Error(`Custom env file not found: ${envFile}`)
}
} else {
// Default behavior: search for .env file in the current directory and its parents
let currentPath = root
const rootPath = parse(root).root
currentPath = dirname(currentPath)
}
while (currentPath !== rootPath) {
const candidate = resolve(currentPath, '.env')
// If not found, check the current working directory
if (!envFile) {
const cwdCandidate = resolve(process.cwd(), '.env')
if (await isFileAccessible(candidate)) {
envFile = candidate
break
}
if (await isFileAccessible(cwdCandidate)) {
envFile = cwdCandidate
currentPath = dirname(currentPath)
}
// If not found, check the current working directory
if (!envFile) {
const cwdCandidate = resolve(process.cwd(), '.env')
if (await isFileAccessible(cwdCandidate)) {
envFile = cwdCandidate
}
}
}

@@ -451,3 +460,4 @@

logger,
skipMetadata
skipMetadata,
envFile: customEnvFile
} = {

@@ -479,3 +489,3 @@ validate: !!schema,

const env = await loadEnv(root, ignoreProcessEnv, additionalEnv)
const env = await loadEnv(root, ignoreProcessEnv, additionalEnv, customEnvFile)
env.PLT_ROOT = root

@@ -482,0 +492,0 @@

@@ -602,4 +602,5 @@ export function overridableValue (spec, defaultValue) {

maxHeapUsed: overridableValue({ type: 'number', minimum: 0, maximum: 1 }, 0.99),
maxHeapTotal: overridableValue({ type: 'number', minimum: 0 }),
maxYoungGeneration: overridableValue({ type: 'number', minimum: 0 })
maxHeapTotal: overridableValue({ type: 'number', minimum: 0 }, 4 * Math.pow(1024, 3)), // 4GB
maxYoungGeneration: overridableValue({ type: 'number', minimum: 0 }, 128 * Math.pow(1024, 2)), // 128MB,
codeRangeSize: overridableValue({ type: 'number', minimum: 0 }, 268435456)
},

@@ -606,0 +607,0 @@ additionalProperties: false

+1
-1
{
"name": "@platformatic/foundation",
"version": "3.19.0",
"version": "3.20.0",
"description": "Platformatic Foundation",

@@ -5,0 +5,0 @@ "main": "index.js",