diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..01c734c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node +COPY . /usr/src/app +WORKDIR /usr/src/app +EXPOSE 3000 +RUN npm install +CMD npm start \ No newline at end of file diff --git a/README.md b/README.md index 34836ac..5a5b5ff 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,9 @@ ```sh $ npm start ``` + +or in docker + +```sh +$ docker build -t gh-oauth-server . && docker run -p :3000 -e CLIENT_SECRET= -d gh-oauth-server +``` diff --git a/server.js b/server.js index c321639..aa036f9 100644 --- a/server.js +++ b/server.js @@ -14,6 +14,10 @@ app.use(bodyParser.json()) app.use(bodyParser.urlencoded({ extended: true })) app.post('*', upload.array(), (req, res) => { + let client_secret = process.env.CLIENT_SECRET + if (client_secret){ + req.body.client_secret = client_secret + } request.post({ url: 'https://github.com/login/oauth/access_token', form: req.body,