Skip to content

Skillbill/confit-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Confit client ##########

Info

This is the Javascript client for the CONFIT Skillbill service

Dev and deploy

  • make your changes
  • modify packge.json version
  • commit your changes
  • build and add dist folder
npm run version
  • push
npm run postversion
  • publish
npm publish

the package is available here

Install

Using npm:

npm install --save confit-client

Using cdn:

<script src="https://unpkg.com/confit-client/dist/confit-client.iife.min.js"></script>
<script>
  // now a Confit object is accessible:
  Confit.load({...}).then(...);
</script>

Usage

Node application

Confit = require('confit-client')

React application

import  Confit  from  'confit-client';

Load a public configuration from alias:

Confit.load({
  repoId: '178474a9-360e-4299-a2e1-e8ae284ce909',
  alias: 'test.site.com-fe'
}).then(configuration => {
  console.log(configuration);
});

Load a private configuration from path:

Confit.load({
  repoId: '178474a9-360e-4299-a2e1-e8ae284ce909',
  repoSecret : 'f18d2da0-5a38-4b2f-8a05-c021cfe48821',
  path: 'test/be.json'
}).then(configuration => {
  console.log(configuration);
});

Instance

It is also possible to create a reusable instance with your defaults to load multiple files:

const confit = Confit.create({
  repoId : '178474a9-360e-4299-a2e1-e8ae284ce909', 
  repoSecret : 'f18d2da0-5a38-4b2f-8a05-c021cfe48821'
});

confit.load({
  path: 'globals.json'
}).then(globals => {
  console.log(globals);
});

confit.load({
  alias: 'be-conf'
}).then(configuration => {
  console.log(configuration);
});