-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
304 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# temporary stuff, this will be handled in the db eventually | ||
TEMP_GUILD_ID= | ||
TEMP_CHANNEL_AUTOMATION_CHANNEL_ID= | ||
TEMP_LOGGING_CHANNEL_ID= | ||
TEMP_JOINING_CHANNEL_ID= | ||
TEMP_LEAVING_CHANNEL_ID= | ||
TEMP_DELETION_LOGGING_CHANNEL_ID= | ||
|
||
# Mongo database information | ||
MONGODB_CONNECTION_URI=mongodb://localhost | ||
MONGODB_DATABASE=test | ||
|
||
# Discord bot options | ||
DISCORD_TOKEN=discord bot token goes here | ||
DISCORD_PREFIX=. | ||
DISCORD_CLIENT_ID=discord app client ID goes here | ||
DISCORD_CLIENT_SECRET=discord app client secret goes here | ||
DISCORD_REDIRECT_URI=discord redirect URI goes here | ||
|
||
# Reddit API authorization info | ||
REDDIT_CLIENT_ID=reddit app client ID goes here | ||
REDDIT_CLIENT_SECRET=reddit app client secret goes here | ||
REDDIT_USER_AGENT=put in a user agent that includes your /u/ | ||
REDDIT_REDIRECT_URI=reddit redirect URI goes here | ||
|
||
# Web server config | ||
PORT=4567 | ||
HOST=http://localhost:4567 | ||
SESSION_SECRET=something sufficiently secret | ||
|
||
# Third party APIs for command functionality | ||
FREECURRENCYAPI_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Build and publish Docker image | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
GIT_COMMIT_HASH=${{ github.sha }} | ||
GIT_REPO_URL=${{ github.repostitoryUrl }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ node_modules | |
|
||
# Secrets | ||
config.* | ||
.env | ||
|
||
# Migration tracking | ||
.migrate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# https://nodejs.org/en/docs/guides/nodejs-docker-webapp | ||
FROM node:18-alpine | ||
WORKDIR /usr/src/app | ||
|
||
# copy package.json/package-lock.json and install dependencies | ||
COPY package*.json ./ | ||
RUN npm ci --omit=dev | ||
|
||
# copy everything else | ||
COPY . . | ||
|
||
# pull in git references from build args | ||
ARG GIT_COMMIT_HASH | ||
ENV GIT_COMMIT_HASH=$GIT_COMMIT_HASH | ||
ARG GIT_REPO_URI | ||
ENV GIT_REPO_URI=$GIT_REPO_URI | ||
|
||
EXPOSE 8080 | ||
USER node | ||
CMD ["sh", "-c", "PORT=8080 NODE_ENV=production npx ts-node --transpile-only src/index.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
const {MongoClient} = require('mongodb'); | ||
const config = require('../config'); | ||
const {MONGODB_CONNECTION_URI, MONGODB_DATABASE} = process.env; | ||
|
||
module.exports.up = async () => { | ||
const mongoClient = new MongoClient(config.mongodb.url, {useUnifiedTopology: true}); | ||
const mongoClient = new MongoClient(MONGODB_CONNECTION_URI, {useUnifiedTopology: true}); | ||
await mongoClient.connect(); | ||
const db = mongoClient.db(config.mongodb.databaseName); | ||
const db = mongoClient.db(MONGODB_DATABASE); | ||
|
||
await db.collection('redditAccounts').createIndex({userID: 1, guildID: 1, redditName: 1}, {unique: true}); | ||
}; | ||
|
||
module.exports.down = async () => { | ||
const mongoClient = new MongoClient(config.mongodb.url, {useUnifiedTopology: true}); | ||
const mongoClient = new MongoClient(MONGODB_CONNECTION_URI, {useUnifiedTopology: true}); | ||
await mongoClient.connect(); | ||
const db = mongoClient.db(config.mongodb.databaseName); | ||
const db = mongoClient.db(MONGODB_DATABASE); | ||
|
||
await db.collection('redditAccounts').dropIndex({userID: 1, guildID: 1, redditName: 1}, {unique: true}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.