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
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.17.1 to 0.18.0

test/fixtures/db-0.16.0.json

13

index.js

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

const { FileWatcher } = require('@platformatic/utils')
const { getParser } = require('@platformatic/metaconfig')
const { getParser, analyze } = require('@platformatic/metaconfig')

@@ -135,2 +135,12 @@ class ConfigManager extends EventEmitter {

this.current = this._parser(await this.replaceEnv(configString))
// try updating the config format to latest
try {
let meta = await analyze({ config: this.current })
while (typeof meta.up === 'function') {
meta = meta.up()
}
this.current = meta.config
} catch {
// nothing to do
}
}

@@ -194,2 +204,3 @@ const validationResult = this.validate()

}
await this._transformConfig()
this.emit('update', this.current)

@@ -196,0 +207,0 @@ return true

6

package.json
{
"name": "@platformatic/config",
"version": "0.17.1",
"version": "0.18.0",
"description": "Platformatic DB Config Manager",

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

"pupa": "^3.1.0",
"@platformatic/utils": "0.17.1",
"@platformatic/metaconfig": "0.17.1"
"@platformatic/utils": "0.18.0",
"@platformatic/metaconfig": "0.18.0"
},

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

@@ -111,1 +111,23 @@ 'use strict'

})
test('should automatically update', { only: true }, async ({ same }) => {
const cm = new ConfigManager({
source: resolve(__dirname, './fixtures/db-0.16.0.json'),
env: { PLT_FOOBAR: 'foobar' }
})
await cm.parse()
same(cm.current, {
$schema: 'https://platformatic.dev/schemas/v0.18.0/db',
server: { hostname: '127.0.0.1', port: '3042', logger: { level: 'info' } },
metrics: { auth: { username: 'plt-db', password: 'plt-db' } },
plugins: { paths: ['./plugin-sum.js'] },
db: {
connectionString: 'postgres://postgres:postgres@localhost:5432/postgres',
graphiql: true,
ignore: { versions: true }
},
migrations: { dir: './demo/migrations', validateChecksums: false },
dashboard: { path: '/' },
authorization: { adminSecret: 'plt-db' }
})
})

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

test('should update valid config without updating the file', async ({ same, teardown, pass, plan }) => {
plan(3)
plan(5)
const config = {

@@ -38,2 +38,5 @@ name: 'Platformatic',

})
cm._transformConfig = (config) => {
pass('transform config')
}
cm.on('update', () => {

@@ -40,0 +43,0 @@ pass('new config available')

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