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
287
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.12.1 to 0.13.0

9

index.js

@@ -135,8 +135,11 @@ 'use strict'

const escapeNewlines = ({ value }) => {
const escapeJSONstring = ({ value }) => {
if (!value) return value
return value.replace(/\n/g, '\\n')
// TODO this shoudl handle all the escapes chars
// defined in https://www.json.org/json-en.html
// but it's good enough for now.
return value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n')
}
return this.pupa(configString, this.env, { transform: escapeNewlines })
return this.pupa(configString, this.env, { transform: escapeJSONstring })
}

@@ -143,0 +146,0 @@

{
"name": "@platformatic/config",
"version": "0.12.1",
"version": "0.13.0",
"description": "Platformatic DB Config Manager",

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

"yaml": "^2.1.3",
"@platformatic/utils": "0.12.1"
"@platformatic/utils": "0.13.0"
},

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

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

})
test('transform placeholders with `\\`', async ({ plan, same }) => {
const cm = new ConfigManager({
source: './file.json',
env: {
PLT_FOO: 'bar\\.bar2\\.bar3',
PLT_USERNAME: 'john\\.john2'
}
})
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\\.bar2\\.bar3'
}
})
})
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