Web server that does Codeberg and GitHub OAuth and then adds the GitHub user to a GitHub organisation
| src | Initial commit | |
| views | Initial commit | |
| .dockerignore | Initial commit | |
| .gitignore | Initial commit | |
| docker-compose.yml | Add README | |
| Dockerfile | Initial commit | |
| LICENSE.txt | Add GPLv2 license text | |
| package.json | Initial commit | |
| README.md | Add README | |
| yarn.lock | Initial commit | |
Codeberg Github Org Invite
What is this?
This is a silly server written using Express JS which allows a user to log in with Codeberg, then with GitHub, then join a GitHub organisation.
It is currently in a minimum viable product, proof of concept state.
How to run
1. .env file
Create a .env file with the following contents:
HOST=https://fill-me-with-actual.data
COOKIE_SECRET=fill me with actual data
GITHUB_ORG_TOKEN=fill me with actual data
GITHUB_ORG_NAME=fill me with actual data
OAUTH_CODEBERG_CLIENT_ID=fill me with actual data
OAUTH_CODEBERG_CLIENT_SECRET=fill me with actual data
OAUTH_GITHUB_CLIENT_ID=fill me with actual data
OAUTH_GITHUB_CLIENT_SECRET=fill me with actual data
The meaning of each environment variable is:
| Variable | Meaning |
|---|---|
HOST |
The website where the webapp is accessible |
COOKIE_SECRET |
Secret used for storing the session with cookies |
GITHUB_ORG_TOKEN |
A personal access token for the GitHub organisation, with read and write access to members (obtain here) |
GITHUB_ORG_NAME |
The name of the GitHub organisation (as in, the name appearing in the URL) |
OAUTH_CODEBERG_CLIENT_ID |
OAuth client ID for Codeberg (obtain here) |
OAUTH_CODEBERG_CLIENT_SECRET |
OAuth client secret for Codeberg |
OAUTH_GITHUB_CLIENT_ID |
OAuth client ID for GitHub (obtain here) |
OAUTH_GITHUB_CLIENT_SECRET |
OAuth client secret for GitHub |
LISTEN_PORT |
(optional; default: 3000) The port to listen on |
LISTEN_HOST |
(optional; default: ::) The host to listen on (see NodeJS docs) |
DB_PATH |
(optional; default: ./db.sqlite) Path for SQLite database |
Check src/config.js for more info.
2.a) Run locally
With the dotenv utility installed, run:
yarn install
dotenv -- node src/index.js
Without the dotenv utility, manually set the environment variables using your shell:
yarn install
HOST=https://example.com \
AND_THE=OTHER_VARIABLES \
node src/index.js
2.b) Docker Compose
Dockerfile and docker-compose.yml files are already provided.
Simply run docker compose up -d --build.
You might consider editing the exposed port in the docker-compose.yml file.