Skip to content

Commit 918e69f

Browse files
authored
Merge pull request #9 from opencomponents/registry
Moving Registry to Heroku
2 parents a84543f + 220a2af commit 918e69f

File tree

5 files changed

+55
-9
lines changed

5 files changed

+55
-9
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
.vscode
33
.DS_Store
44
_package
5-
oc.json
5+
*.log
6+
.env

components/oc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"registries": [
3+
"https://opencomponents.herokuapp.com/"
4+
]
5+
}

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ga('create', 'UA-54446639-6', 'auto');
1818
ga('send', 'pageview');
1919
</script>
20-
<oc-component href="https://opencomponents.now.sh/landing-page"></oc-component>
21-
<script src="https://opencomponents.now.sh/oc-client/client.js"></script>
20+
<oc-component href="https://opencomponents.herokuapp.com/landing-page"></oc-component>
21+
<script src="https://opencomponents.herokuapp.com/oc-client/client.js"></script>
2222
</body>
2323
</html>

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"start": "oc dev components 3030",
8-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"start": "node registry/server.js",
8+
"dev": "oc dev components 3030"
99
},
1010
"repository": {
1111
"type": "git",
@@ -18,10 +18,11 @@
1818
"url": "https://github.com/opencomponents/opencomponents.github.io/issues"
1919
},
2020
"homepage": "https://github.com/opencomponents/opencomponents.github.io#readme",
21-
"devDependencies": {
22-
"oc": "^0.41.16"
23-
},
2421
"dependencies": {
25-
"oc-template-handlebars-compiler": "^6.1.3"
22+
"dotenv": "^4.0.0",
23+
"oc": "^0.42.7"
24+
},
25+
"engines": {
26+
"node": "8.9.1"
2627
}
2728
}

registry/server.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
// Store ENV variables in .env to set up your local development
4+
// https://github.com/motdotla/dotenv#usage
5+
require('dotenv').config();
6+
const Registry = require('oc').Registry;
7+
8+
// Minimal configuration for the registry
9+
// For advanced configuration check the documantion:
10+
// https://github.com/opentable/oc/wiki/Registry
11+
const configuration = {
12+
baseUrl: process.env.NOW_URL || process.env.BASEURL,
13+
port: process.env.PORT || 3000,
14+
publishAuth: {
15+
type: 'basic',
16+
username: process.env.PUBLISH_USERNAME,
17+
password: process.env.PUBLISH_PASSWORD
18+
},
19+
s3: {
20+
key: process.env.S3_KEY,
21+
secret: process.env.S3_SECRET,
22+
bucket: process.env.S3_BUCKET,
23+
region: process.env.S3_REGION,
24+
path: `//s3.${process.env.S3_REGION}.amazonaws.com/${process.env.S3_BUCKET}/`,
25+
componentsDir: 'components'
26+
},
27+
env: { name: 'production' },
28+
dependencies: []
29+
};
30+
31+
// Instantiate the registry
32+
// An express.js istance is exposed as registry.app
33+
const registry = new Registry(configuration);
34+
registry.start((err, app) => {
35+
if (err) {
36+
console.log('Registry not started: ', err);
37+
process.exit(1);
38+
}
39+
});

0 commit comments

Comments
 (0)