Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bbc-cosmos-tools-config

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbc-cosmos-tools-config

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

BBC::Cosmos::Tools::Config

This gem provides functionality to generate and push config to the cosmos platform.

Installation

Add this line to your application's Gemfile:

gem 'bbc-cosmos-tools-config'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bbc-cosmos-tools-config

Usage

The gem expects a certain folder structure for the config files:

Folder structure
 ├── configs
 │   ├── {env_name (int/test/stage/live)}
 │   │   ├── {project_name}.yaml
 │   ├── app_config.yaml

an example of this would be:

 ├── configs
 │   ├── int
 │   │   ├── my_project.yaml
 │   ├── test
 │   │   ├── my_project.yaml
 │   ├── stage
 │   │   ├── my_project.yaml
 │   ├── live
 │   │   ├── my_project.yaml
 │   ├── app_config.yaml
Project Config structure

All of the configs are in yaml format, the project yaml has the following format:


components:
  "component_id":
    a_config_key: "it's value"
	another_key: "Another value"

shared:
  shared_key: "shared_value"

The config has a number of components under a project, and the shared key allows you to have shared config for the components. The config is built up from the shared data with the component config merged in afterwards.

Application config

There's also an application config that stores data used by the app, at the moment this is only the api endpoints.

bbc:
  cosmos:
    api: "https://www.my.api.com"
	endpoint: "/some/restful/endpoint"

The gem is a cli application and currently has two functions:

Generating config

bbc-cosmos-tools-config generate {project_name} [{component_id = nil, environment = 'int' --cosmos_format]

project_name The project name is required, the other parameters are optional.

component_id This is the id of the component in the components block of the project config. If you omit the component id then all components for the project are output.

environment This maps to the folder underneath the configs directory, is omitted int is chosen as default.

--cosmos_output As the cosmos API requires a slightly different JSON structure, you can have it formatted this way by passing this flag.

Pushing config

bbc-cosmos-tools-config push {project_name} [{cert_path = nil, component_id = nil, environment = 'int' --force]

project_name The project name is required, the other parameters are optional.

cert_path This is the path to a valid client cert that can authenticate with the supplied API.

component_id This is the id of the component in the components block of the project config. If you omit the component id then all components for the project have their configs updated.

environment This maps to the folder underneath the configs directory, is omitted int is chosen as default.

--force By default, before pushing changes to the API you're asked to confirm the action - This flag removes that confirmation.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 23 Apr 2014

Did you know?

Socket

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.

Install

Related posts

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