Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@platformatic/config

Package Overview
Dependencies
Maintainers
6
Versions
291
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/config - npm Package Compare versions

Comparing version 1.50.0 to 2.0.0-alpha.1

17

lib/manager.js

@@ -55,2 +55,3 @@ 'use strict'

this._originalEnv = opts.env || {}
this.context = opts.context || {}
this.env = { ...this._originalEnv }

@@ -98,3 +99,12 @@ this._onMissingEnv = opts.onMissingEnv

const value = config[key]
config[key] = await this.replaceEnv(value, { env, escapeJSON: false })
config[key] = await this.replaceEnv(
value,
{
env,
context: opts.context,
escapeJSON: false,
parent: config,
tree: [...opts.tree ?? [], config]
}
)
}

@@ -106,3 +116,3 @@ return config

if (!value && this._onMissingEnv) {
value = this._onMissingEnv(key)
value = this._onMissingEnv(key, opts)
}

@@ -138,3 +148,4 @@

escapeJSON: false,
ignore: this._replaceEnvIgnore
ignore: this._replaceEnvIgnore,
context: this.context
})

@@ -141,0 +152,0 @@ }

80

lib/store.js

@@ -15,2 +15,8 @@ 'use strict'

const defaultTypes = [
'service',
'db',
'composer'
]
class Store {

@@ -71,31 +77,26 @@ #map = new Map()

// try to load module
if (!app && extendedModule) {
try {
app = require(extendedModule)
} catch (err) {
if (err.code === 'ERR_REQUIRE_ESM') {
const toLoad = require.resolve(extendedModule)
app = (await import('file://' + toLoad)).default
} else {
throw err
}
const match = $schema?.match(/\/schemas\/(.*)\/(.*)/)
let type = match?.[2]
// Legacy Platformatic apps
if (!app && !type && $schema?.indexOf('./') === 0 && !extendedModule) {
if (core || db) {
type = 'db'
} else {
type = 'service'
}
}
const match = $schema?.match(/\/schemas\/(.*)\/(.*)/)
if (!app && match) {
const type = match[2]
if (!app && type) {
const toLoad = `https://platformatic.dev/schemas/v${pltVersion}/${type}`
app = this.#map.get(toLoad)
if (!app && defaultTypes.includes(type)) {
app = await loadModule(require, `@platformatic/${type}`)
this.add(app)
}
}
// Legacy Platformatic apps
if (!app && $schema?.indexOf('./') === 0) {
if (core || db) {
app = this.#map.get(`https://platformatic.dev/schemas/v${pltVersion}/db`)
} else {
app = this.#map.get(`https://platformatic.dev/schemas/v${pltVersion}/service`)
}
// try to load module
if (!app && extendedModule) {
app = await loadModule(require, extendedModule)
}

@@ -143,4 +144,7 @@

const typeSet = new Set()
for (const _ of types) {
const type = _.configType
typeSet.add(type)
_.filenames = [

@@ -156,2 +160,21 @@ `platformatic.${type}.json`,

for (const type of defaultTypes) {
if (typeSet.has(type)) {
continue
}
const _ = {
configType: type,
filenames: [
`platformatic.${type}.json`,
`platformatic.${type}.json5`,
`platformatic.${type}.yaml`,
`platformatic.${type}.yml`,
`platformatic.${type}.toml`,
`platformatic.${type}.tml`
]
}
types.push(_)
}
types.push({

@@ -247,2 +270,15 @@ filenames: [

async function loadModule (require, extendedModule) {
try {
return require(extendedModule)
} catch (err) {
if (err.code === 'ERR_REQUIRE_ESM') {
const toLoad = require.resolve(extendedModule)
return (await import('file://' + toLoad)).default
} else {
throw err
}
}
}
module.exports.Store = Store
{
"name": "@platformatic/config",
"version": "1.50.0",
"version": "2.0.0-alpha.1",
"description": "Platformatic DB Config Manager",

@@ -40,3 +40,3 @@ "main": "index.js",

"undici": "^6.9.0",
"@platformatic/utils": "1.50.0"
"@platformatic/utils": "2.0.0-alpha.1"
},

@@ -43,0 +43,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc