Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1488fe6

Browse filesBrowse files
committed
Provide a docker image for running github2range
1 parent 38bb1f0 commit 1488fe6
Copy full SHA for 1488fe6

File tree

5 files changed

+1256
-1
lines changed
Filter options

5 files changed

+1256
-1
lines changed

‎.gitignore

Copy file name to clipboard
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.DS_Store
22
node_modules
3-
package-lock.json
43
.github2rangerc

‎Dockerfile

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node:10
2+
WORKDIR /usr/src/github2range
3+
COPY package*.json ./
4+
RUN npm install
5+
COPY lib/* ./lib/
6+
CMD ["npm", "start"]

‎README.md

Copy file name to clipboardExpand all lines: README.md
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,25 @@ locations:
6969
- `/etc/github2rangerc`
7070
- `/etc/github2range/config`
7171

72+
## Docker
73+
74+
This repository provides a `Dockerfile` which can be used to execute `github2range`. You can
75+
customize the Dockerfile and copy over a config file to one of the above locations, or you can pass
76+
configuration options to docker via environment variables. For example:
77+
78+
```bash
79+
docker build -t github2range .
80+
docker run \
81+
--env github2range_githubAccessToken=XXXXXXXX \
82+
--env github2range_rangeWebhook=https://in.range.co/services/incoming/XXXXXXXX \
83+
--env github2range_users__catboy=conner@pjmasks.com \
84+
--env github2range_users__owlette=amaya@pjmasks.com \
85+
--env github2range_users__ghlogin=email@company.com \
86+
github2range
87+
```
88+
89+
A prebuilt is available on Docker hub at [pupius/github2range](https://hub.docker.com/r/pupius/github2range).
90+
7291
## FAQ
7392

7493
### How do I get a GitHub access token?

‎lib/index.js

Copy file name to clipboardExpand all lines: lib/index.js
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const cfg = rc('github2range', {
3636

3737
colors.setTheme(cfg.colors);
3838

39+
validateConfig();
40+
3941
// We use Octokit to access GitHub REST APIS. See https://octokit.github.io/rest.js/ for docs.
4042
const client = octokit({
4143
userAgent: `github2range/${pkg.version}`,
@@ -218,3 +220,14 @@ function emailHash(email) {
218220
shasum.update(email);
219221
return shasum.digest('hex');
220222
}
223+
224+
function validateConfig() {
225+
if (!cfg.githubAccessToken) exit('githubAccessToken not specified');
226+
if (!cfg.rangeWebhook) exit('rangeWebhook not specified');
227+
if (Object.values(cfg.users).length === 0) exit('no users configured');
228+
}
229+
230+
function exit(msg) {
231+
console.error(`ERROR: ${msg}\n`.error);
232+
process.exit(1);
233+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.