Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Official Confy API library client for node.js
This library is generated by alpaca
Make sure you have npm installed.
$ npm install confyio
Works with [ 0.10 / 0.12 / 4 / 6 ]
There are two ways of pointing to the credential document. You need to choose one of them.
Using user's authentication information
'https://user:pass@api.confy.io/orgs/orgname/projects/projectname/envs/envname/config'
Using unique access token
'https://api.confy.io/orgs/orgname/config/abcdefabcdefabcdef1234567890abcdefabcdef'
var confy = require('confyio');
// When the document is the following
// => { 'port': 6000, 'db': { 'pass': 'sun' } }
You need to provide either an URL or an options objects to point the API client to the correct credential document.
// User URL
var endpoint = {
user: 'user', // Username of the user trying to access the document
pass: 'pass', // Password of the user trying to access the document
org: 'company', // Name of the organization
project: 'app', // Name of the project
env: 'production', // Name of the stage
};
var endpoint = 'https://user:pass@api.confy.io/orgs/orgname/projects/projectname/envs/envname/config';
// Access Token URl
var endpoint = {
org: 'company', // Name of the organization
token: 'abcdefabcdefabcdef1234567890abcdefabcdef' // Access token of the document
};
var endpoint = 'https://api.confy.io/orgs/orgname/config/abcdefabcdefabcdef1234567890abcdefabcdef';
There are two ways of loading the credentials.
You can load it as a hash object with the same structure into a variable.
confy.config.load(endpoint, function (err, config) {
config.port // => 6000
config.db.pass // => 'sun'
});
You can load it directly into process.env
with the key formed by concatenizing the path keys with underscores.
confy.config.env(endpoint, function (err) {
// ['port']
process.env.PORT // => 6000
// ['db']['pass']
process.env.DB_PASS // => 'sun'
});
var auth = { username: 'pksunkara', password: 'password' };
var client = confy.client(auth, clientOptions);
The following options are available while instantiating a client:
All the callbacks provided to an api call will receive the response as shown below
// You can also omit the 'methodOptions' param below
client.klass('args').method('args', methodOptions, function (err, response) {
if (err) console.log(err);
response.code;
// >>> 200
response.headers;
// >>> {'x-server': 'apache'}
}
When the response sent by server is json, it is decoded into a hash
response.body;
// >>> {'user': 'pksunkara'}
The following options are available while calling a method of an api:
Set request_type in options to modify the body accordingly
When the value is set to raw, don't modify the body at all.
body = 'username=pksunkara';
// >>> 'username=pksunkara'
When the value is set to json, JSON encode the body.
body = {'user': 'pksunkara'};
// >>> '{"user": "pksunkara"}'
User who is authenticated currently.
var user = client.user();
Get the authenticated user's profile.
user.retrieve(options, callback);
Update the authenticated user's profile. Should use basic authentication.
The following arguments are required:
user.update(options, callback);
Organizations are owned by users and only (s)he can add/remove teams and projects for that organization. A default organization will be created for every user.
var orgs = client.orgs();
List all organizations the authenticated user is a member of.
orgs.list(options, callback);
Get the given organization if the authenticated user is a member.
The following arguments are required:
orgs.retrieve("big-company", options, callback);
Update the given organization if the authenticated user is the owner. Email is the only thing which can be updated.
The following arguments are required:
orgs.update("big-company", "admin@bigcompany.com", options, callback);
Every organization will have a default team named Owners. Owner of the organization will be a default member for every team.
The following arguments are required:
var teams = client.teams("big-company");
List teams of the given organization authenticated user is a member of.
teams.list(options, callback);
Create a team for the given organization. Authenticated user should be the owner of the organization.
The following arguments are required:
teams.create("Consultants", "Guys who are contractors", options, callback);
Get the given team in the given organization. Access only if the authenticated user is a member of the team.
The following arguments are required:
teams.retrieve("consultants", options, callback);
Update the given team. Description is the only thing which can be updated. Authenticated user should be the owner of the organization.
The following arguments are required:
teams.update("consultants", "Guys who are contractors", options, callback);
Delete the given team. Cannot delete the default team in the organization. Authenticated user should be the owner of the organization.
The following arguments are required:
teams.destroy("consultants", options, callback);
Retrieve the list of projects the given team has access to. Authenticated user should be a member of the team.
The following arguments are required:
teams.projects("consultants", options, callback);
Teams contain a list of users. The Authenticated user should be the owner of the organization.
The following arguments are required:
var members = client.members("big-company", "consultants");
List all the members in the given team. Authenticated user should be a member of the team or the owner of the org.
members.list(options, callback);
Add the user to the given team. The user in the request needs to be a string and be the username of a valid user. The Authenticated user should be the owner of the organization.
The following arguments are required:
members.add("johnsmith", options, callback);
Remove users from the given team. The user in the request needs to be a string and be the username of a valid user. Cannot delete the default member in a team. The Authenticated user should be the owner of the organization.
The following arguments are required:
members.remove("johnsmith", options, callback);
An organization can contain any number of projects.
The following arguments are required:
var projects = client.projects("big-company");
List all the projects of the given organization which can be accessed by the authenticated user.
projects.list(options, callback);
Create a project if the authenticated user is the owner of the given organization. Only the owners team will be able to see the project initially.
The following arguments are required:
projects.create("Knowledge Base", "Support FAQ & Wiki", options, callback);
Get the given project in the given organization. Works only if the authenticated user has access to the project.
The following arguments are required:
projects.retrieve("knowledge-base", options, callback);
Update the given project. Description is the only thing which can be updated. Authenticated user should be the owner of the organization.
The following arguments are required:
projects.update("knowledge-base", "Support FAQ and Wiki", options, callback);
Delete the given project. Authenticated user should be the owner of the organization.
The following arguments are required:
projects.destroy("knowledge-base", options, callback);
List of teams whic have access to the project. Default team Owners will have access to every project. Authenticated user should be the owner of the organization for the below endpoints.
The following arguments are required:
var access = client.access("big-company", "knowledge-base");
Retrieve a list of teams which have access to the given project. Authenticated user should be a member of the team.
access.list(options, callback);
Give the team access to the given project. The team in the request needs to be a string and should be the name of a valid team. Authenticated user should be the owner of the organization.
The following arguments are required:
access.add("consultants", options, callback);
Remove project access for the given team. The team in the request needs to be a string and should be the name of a valid team. Can't delete default team's access. Authenticated user should be the owner of the organization.
The following arguments are required:
access.remove("consultants", options, callback);
Every project has a default environment named Production. Each environment has one configuration document which can have many keys and values.
The following arguments are required:
var envs = client.envs("big-company", "knowledge-base");
List all the environmens of the project. The authenticated user should have access to the project.
envs.list(options, callback);
Create an environment. The authenticated user should have access to the project.
The following arguments are required:
envs.create("QA", "Quality assurance guys server", options, callback);
Get the given environment in the given project. The authenticated user should have access to the project.
The following arguments are required:
envs.retrieve("qa", options, callback);
Update the given environment. Description is the only thing which can be updated. Authenticated user should have access to the project.
The following arguments are required:
envs.update("qa", "Testing server for QA guys", options, callback);
Delete the given environment. Authenticated user should have access to the project. Cannot delete the default environment.
The following arguments are required:
envs.destroy("knowledge-base", options, callback);
Any member of the team which has access to the project can retrieve any of it's environment's configuration document or edit it.
The following arguments are required:
var config = client.config("big-company", "knowledge-base", "production");
Get an environment configuration
config.retrieve(options, callback);
Update the configuration document for the given environment of the project. We will patch the document recursively.
The following arguments are required:
config.update({
database: {
port: 6984
},
random: "wow"
}, options, callback);
List the last 10 versions of the environment configuration
config.versions(options, callback);
Here is a list of Contributors
BSD
Report here.
Pavan Kumar Sunkara (pavan.sss1991@gmail.com)
FAQs
Official Confy API library client for node.js
The npm package confyio receives a total of 1 weekly downloads. As such, confyio popularity was classified as not popular.
We found that confyio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.