You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

platformsh-config

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

platformsh-config - npm Package Compare versions

Comparing version

to
2.4.0

.github/workflows/npm-publish.yaml

14

CHANGELOG.md
# Changelog
## [2.4.0] - 2021-02-03
### Added
* GitHub actions for tests (`quality-assurance.yaml`) and publishing to npm (`npm-publish.yaml`).
### Changed
* `config` method can now get an object `{ varPrefix: string }` to specify a different environment variables prefix.
### Removed
* CircleCI action config.
## [2.3.1] - 2019-11-04

@@ -4,0 +18,0 @@

10

lib/platformsh.js

@@ -27,5 +27,5 @@ 'use strict';

constructor(env = null, prefix = 'PLATFORM_') {
constructor(env = null, varPrefix = 'PLATFORM_') {
this.environmentVariables = env || process.env;
this.envPrefix = prefix;
this.varPrefix = varPrefix;

@@ -571,3 +571,3 @@ // Node doesn't support pre-defined object properties in classes, so

_getValue(name) {
let checkName = this.envPrefix + name.toUpperCase();
let checkName = this.varPrefix + name.toUpperCase();

@@ -624,5 +624,5 @@ return this.environmentVariables[checkName] || null;

*/
function config() {
function config({ varPrefix } = {}) {
return new Config();
return new Config(null, varPrefix);
}

@@ -629,0 +629,0 @@

{
"name": "platformsh-config",
"version": "2.3.1",
"version": "2.4.0",
"description": "Helper for running nodejs applications on Platform.sh",

@@ -5,0 +5,0 @@ "main": "lib/platformsh.js",

# Platform.sh Config Reader (Node.js)
![Quality Assurance](https://github.com/platformsh/config-reader-nodejs/workflows/Quality%20Assurance/badge.svg)
This library provides a streamlined and easy to use way to interact with a Platform.sh environment. It offers utility methods to access routes and relationships more cleanly than reading the raw environment variables yourself.

@@ -109,2 +111,9 @@

By default, Platform.sh environment variables are prefixed with `PLATFORM_`. In some cases, you might need to change this default in order to have access to environment variables at build time (like with [create-react-app](https://create-react-app.dev/docs/adding-custom-environment-variables/)).
You can do this like so:
```js
const config = require("platformsh-config").config({ varPrefix: "MY_PREFIX_" });
```
### Reading service credentials

@@ -111,0 +120,0 @@

Sorry, the diff of this file is not supported yet