1.0.0-rc.2 • Published 3 years ago
@yag/k8secrets v1.0.0-rc.2
@yag/k8secrets
Copyright (c) 2018, Yassel Avila Gil.
What is this?
Utilities to access secrets and config-maps in Kubernetes from Serverless environments such as Fission.io, Kubeless or similar.
License
New BSD License. See LICENSE.txt.
Documentation
This library includes type definitions for TypeScript.
Installation
@yag/k8secrets
is available for Node.js on npm. To install it, type:
npm install -P @yag/k8secrets
Usage
TypeScript:
import { getSecret, getConfigMap } from '@yag/k8secrets';
console.log( getSecret('my-secret') );
console.log( getSecret<TypeOfSecret>('my-other-secret') );
console.log( getConfigMap('my-config-map') );
console.log( getConfigMap<TypeOfConfigMap>('my-other-config-map') );
ES6+:
const { getSecret, getConfigMap } = require('@yag/k8secrets');
console.log( getSecret('my-secret') );
console.log( getConfigMap('my-config-map') );
JavaScript (ES5 / CommonJS):
var k8secrets = require('@yag/k8secrets');
console.log( k8secrets.getSecret('my-secret') );
console.log( k8secrets.getConfigMap('my-config-map') );
Configuration
You can configure paths using built-in configuration functions such as setConfig
or restoreConfig
.
Example:
import { getDefaultConfig, setConfig, getConfig, restoreConfig } from '@yag/k8secrets';
/* Access the default/inmutable config */
console.log('Default config: ', getDefaultConfig());
/* All is optional */
setConfig({
// Default: 'default'
defaultNamespace: 'functions',
// Default: '/'
basePath: '/etc',
// Default: '/secrets'
secretsPath: '/my/path/to/secrets',
// Default: '/configs'
configMapsPath: '/my/path/to/configs'
});
/* Retrieve the current config */
console.log('Current config: ', getConfig());
/* Restore the default config */
restoreConfig();
console.log('Config: ', getConfig());
1.0.0-rc.1
3 years ago
1.0.0-rc.2
3 years ago
1.0.0-rc.0
5 years ago
1.0.0-alpha.3
6 years ago
1.0.0-alpha.2
6 years ago
1.0.0-alpha.1
6 years ago