Update REAMDE and Gitpod config

Signed-off-by: Andrei Jiroh Eugenio Halili <ajhalili2006@gmail.com>
This commit is contained in:
Andrei Jiroh Halili 2022-04-21 08:37:29 +00:00
parent 75d233f0b8
commit fdd3a14bba
6 changed files with 52 additions and 14 deletions

View File

@ -1,5 +1,17 @@
image:
file: .gitpod.Dockerfile
tasks:
# Install packages, preloads user's librc in its base64-encoded form and decode back to ~/.librc
- init: |
npm install
npm install
before: |
eval $(gp env -e)
if [[ $STDLIBRC != "" ]]; then
echo $STDLIBRC | base64 -d | tee ~/.librc.test >> /dev/null
fi
command: npn run dev
vscode:
extensions:
- GitLab.gitlab-workflow
- exiasr.hadolint

6
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"recommendations": [
"gitlab.gitlab-workflow",
"exiasr.hadolint"
]
}

View File

@ -1,18 +1,29 @@
# verify.rtapp.io backend
# Verification Endpoint API backend
This is the backend code the Recap Time Squad is using on our. This project is helpful on those who maintain their own fork of
the repo in both GitHub and GitLab repos. It's still an work in progress througn, but if you like to contribute, ask @ajhalili2006
over Discord (check the links below)
[![Open in gitpod](https://img.shields.io/badge/Gitpod-ready--to--code-908a85?logo=gitpod)](https://gitpod.io/#https://gitlab.com/RecapTime/infra/rtapp-verify-backend-autocode)
This is our source code for the Verification Endpoint API handler and Discord bot running on Autocode, usually synchorized every hour through GitLab CI.
API calls from `verify.rtapp.<tk|io>` domain will be trnsparently redirected to the production release at `rtapp-verify-backend.recaptime.autocode.gg`.
## Development
Requires Node.js 14+ and Autocode CLI if you want to do local development or even deployment to development/production environments on Autocode.
### Setup
1. `npm install`
2. `npm start` to run an local FunctionScript gateway with hot reload included.
3. `curl -i http://localhost:8170/recaptime/rtapp-verify-backend/ping`
## Getting help
* Discord: For Autocode users who are in the official Autocode Discord sevrer, just ping Andrei Jiroh (`Andrei Jiroh#`).
You can also optionally join
* Discord: For Autocode users who are in [the official Autocode Discord sevrer](https://discord.gg/autocode) or Miraheze users on Miraheze Discord, just ping Andrei Jiroh (`Andrei Jiroh#7159`). You can also optionally [join Recap Time Squad's Discord server](https://discord.gg/5dURUcM) and ask for help under `#rtapp-verify-bot` channel.
* Issue tracker: We track issues on <https://gitlab.com/RecapTime/verify/issues> instead.
## Related Projects
* [Main rtapp-verify repo](https://gitlab.com/RecapTime/verify) ([GitHub mirror](https://github.com/RecapTime/verify) is available
through we use issue forms) - where all the
* [Main project repo](https://gitlab.com/RecapTime/verify) ([GitHub mirror](https://github.com/RecapTime/verify) is available through we use issue forms) - all the verification metadata are being stored publicly, through some private data are held in an MongoDB database instead.
## Credits

View File

@ -1,6 +1,7 @@
/**
* Environment variable loader from our env.json file (omitted from GitLab code export due to potential leakage
* of secrets). It is usually loaded when
* of secrets). It is usually loaded at top of most of the functions and usually used at local development and
* when doing API development using Gitpod/containers.
*/
function loadEnvFromFile() {
const fs = require('fs');
@ -8,12 +9,20 @@ function loadEnvFromFile() {
fs.access("/opt/node_modules/autocode-common/configs", (err) => {
if (err) {
fs.access('env.json', (err) => {
/**
* If env.json exists locally, attempt to load them automagically within the Node.js process.
*/
const env = require("../env.json")
if (!err) {
process.env["MONGO_DATABASE"] = env.dev.MONGO_DATABASE
process.env["DISCORD_GUILD_ID"] = env.dev.DISCORD_GUILD_ID,
process.env["DISCORD_ROLE_ID"] = env.dev.DISCORD_GUILD_ID
process.env.MONGO_DATABASE = env.dev.MONGO_DATABASE
process.env.DISCORD_GUILD_ID = env.dev.DISCORD_GUILD_ID,
process.env.DISCORD_ROLE_ID = env.dev.DISCORD_GUILD_ID,
process.env.MW_OAUTH_CLIENT_ID = env.dev.MW_OAUTH_CLIENT_ID,
process.env.MW_OAUTH_CLIENT_SECRET = env.dev.MW_OAUTH_CLIENT_SECRET,
process.env.MW_MW_OAUTH_CALLBACK = env.dev.MW_OAUTH_CALLBACK,
process.env.MW_OAUTH_ROOT = env.dev.MW_OAUTH_ROOT
} else {
/** Otherwise, preload secrets using dotenv */
require("dotenv").config()
}
})

View File

@ -6,7 +6,7 @@
"publish": false,
"scripts": {
"start": "lib http",
"dev": "nodemon --exec \"lib http\"",
"dev": "npm run start",
"deploy:dev": "lib up dev",
"deploy:prod": "lib release"
},

0
readme/.empty Executable file
View File