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

@platformatic/config

Package Overview
Dependencies
Maintainers
5
Versions
288
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 0.7.0 to 0.8.0

14

index.js

@@ -29,3 +29,3 @@ 'use strict'

} else {
this.fullPath = join(tmpdir(), `platformatic-config-${Date.now()}.json`)
this.fullPath = join(tmpdir(), `platformatic-config-${process.pid}-${Date.now()}.json`)
this.current = opts.source

@@ -143,3 +143,9 @@ this._shouldSave = true

this.env = this.purgeEnv(env)
return this.pupa(configString, this.env)
const escapeNewlines = ({ value }) => {
if (!value) return value
return value.replace(/\n/g, '\\n')
}
return this.pupa(configString, this.env, { transform: escapeNewlines })
}

@@ -175,3 +181,5 @@

}
throw new Error(`Cannot parse config file. ${err.message}`)
const newerr = new Error(`Cannot parse config file. ${err.message}`)
newerr.cause = err
throw newerr
}

@@ -178,0 +186,0 @@ }

{
"name": "@platformatic/config",
"version": "0.7.0",
"version": "0.8.0",
"description": "Platformatic DB Config Manager",

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

"dependencies": {
"@platformatic/utils": "0.7.0",
"@platformatic/utils": "0.8.0",
"@iarna/toml": "^2.2.5",

@@ -27,0 +27,0 @@ "ajv": "^8.11.0",

@@ -86,1 +86,27 @@ 'use strict'

})
test('transform placeholders with newlines', async ({ plan, same }) => {
const cm = new ConfigManager({
source: './file.json',
env: {
PLT_FOO: 'bar\nbar2\nbar3',
PLT_USERNAME: 'john\njohn2'
}
})
const config = {
server: {
hostname: '127.0.0.1',
port: '3042',
replace: '{PLT_FOO}'
}
}
const res = await cm.replaceEnv(JSON.stringify(config))
same(JSON.parse(res), {
server: {
hostname: '127.0.0.1',
port: '3042',
replace: 'bar\nbar2\nbar3'
}
})
})
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