Registry configuration
Introduction
The registry is a REST api that serves the components. You can have multiple registries connected to a library, but you can't have multiple libraries connected to a registry.
Setup
First, create a dir and install oc:
mkdir oc-registry && cd oc-registry
npm init
npm install oc --save
touch index.js
For Google Storage registry configuration's documentation, look at this page.
This is the index.js
content:
var oc = require("oc");
var configuration = {
verbosity: 0,
baseUrl: "https://my-components-registry.mydomain.com/",
port: 3000,
tempDir: "./temp/",
refreshInterval: 600,
pollingInterval: 5,
s3: {
key: "your-s3-key",
secret: "your-s3-secret",
bucket: "your-s3-bucket",
region: "your-s3-region",
path: "//s3.amazonaws.com/your-s3-bucket/",
componentsDir: "components",
},
env: { name: "production" },
};
var registry = new oc.Registry(configuration);
registry.start(function (err, app) {
if (err) {
console.log("Registry not started: ", err);
process.exit(1);
}
});
API
var registry = new oc.Registry(configuration);
Creates an instance of the registry. Configuration is an object that contains the registry configuration parameters.
registry.start(callback)
Starts the registry.
registry.off(eventName, callback);
For unsubscribing to an event.
registry.on(eventName, callback);
For subscribing to an event.