Compare commits
1 commit
45c064709b
...
c90a13ed97
Author | SHA1 | Date | |
---|---|---|---|
c90a13ed97 |
14 changed files with 316 additions and 489 deletions
2
.dev.env
2
.dev.env
|
@ -16,8 +16,6 @@ BOT_ENV=4
|
|||
ABOUT_FUNDING=
|
||||
ABOUT_REPO=
|
||||
|
||||
DATA_DIR=
|
||||
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3301
|
||||
DB_NAME=carddrop
|
||||
|
|
76
.drone.yml
76
.drone.yml
|
@ -4,36 +4,16 @@ kind: pipeline
|
|||
name: deployment
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: node
|
||||
commands:
|
||||
- npm ci
|
||||
- npm run build
|
||||
- name: test
|
||||
image: node
|
||||
commands:
|
||||
- npm test
|
||||
- name: deploy to prod
|
||||
image: drillster/drone-rsync
|
||||
secrets: [ ssh_key, bot_token_prod ]
|
||||
- name: deploy
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
hosts:
|
||||
- 192.168.68.120
|
||||
user: vylpes
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
source: .
|
||||
target: ~/apps/card-drop/card-drop_prod
|
||||
recursive: true
|
||||
host: 192.168.68.120
|
||||
username: vylpes
|
||||
password:
|
||||
from_secret: ssh_password
|
||||
port: 22
|
||||
script:
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
- export PATH="$HOME/.nodeuse/bin:$PATH"
|
||||
- export BOT_TOKEN="$BOT_TOKEN_PROD"
|
||||
- cd ~/apps/card-drop/card-drop_prod
|
||||
- docker compose --file docker-compose.prod.yml up -d
|
||||
- sleep 10
|
||||
- cp .prod.env .env
|
||||
- pm2 restart card-drop_prod || pm2 start --name card-drop_prod dist/bot.js
|
||||
- sh /home/vylpes/scripts/card-drop/deploy_prod.sh
|
||||
|
||||
trigger:
|
||||
event:
|
||||
|
@ -45,36 +25,16 @@ kind: pipeline
|
|||
name: staging
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: node
|
||||
commands:
|
||||
- npm ci
|
||||
- npm run build
|
||||
- name: test
|
||||
image: node
|
||||
commands:
|
||||
- npm test
|
||||
- name: deploy to stage
|
||||
image: drillster/drone-rsync
|
||||
secrets: [ ssh_key, bot_token_stage ]
|
||||
- name: stage
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
hosts:
|
||||
- 192.168.68.120
|
||||
user: vylpes
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
source: .
|
||||
target: ~/apps/card-drop/card-drop_stage
|
||||
recursive: true
|
||||
host: 192.168.68.120
|
||||
username: vylpes
|
||||
password:
|
||||
from_secret: ssh_password
|
||||
port: 22
|
||||
script:
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
- export PATH="$HOME/.nodeuse/bin:$PATH"
|
||||
- export BOT_TOKEN="$BOT_TOKEN_STAGE"
|
||||
- cd ~/apps/card-drop/card-drop_stage
|
||||
- docker compose --file docker-compose.stage.yml up -d
|
||||
- sleep 10
|
||||
- cp .stage.env .env
|
||||
- pm2 restart card-drop_stage || pm2 start --name card-drop_stage dist/bot.js
|
||||
- sh /home/vylpes/scripts/card-drop/deploy_stage.sh
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
|
@ -93,13 +53,17 @@ steps:
|
|||
commands:
|
||||
- npm ci
|
||||
- npm run build
|
||||
|
||||
- name: test
|
||||
image: node
|
||||
commands:
|
||||
- npm ci
|
||||
- npm test
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
- develop
|
||||
- hotfix/*
|
||||
- feature/*
|
||||
- renovate/*
|
||||
|
|
|
@ -16,8 +16,6 @@ BOT_ENV=1
|
|||
ABOUT_FUNDING=
|
||||
ABOUT_REPO=
|
||||
|
||||
DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_prod
|
||||
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3321
|
||||
DB_NAME=carddrop
|
||||
|
|
|
@ -16,8 +16,6 @@ BOT_ENV=2
|
|||
ABOUT_FUNDING=
|
||||
ABOUT_REPO=
|
||||
|
||||
DATA_DIR=/home/vylpes/appdata/card-drop/card-drop_stage
|
||||
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3311
|
||||
DB_NAME=carddrop
|
||||
|
|
702
package-lock.json
generated
702
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -40,10 +40,11 @@
|
|||
"typeorm": "0.3.17"
|
||||
},
|
||||
"resolutions": {
|
||||
"**/undici": "^5.26.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.0.0",
|
||||
"np": "^9.0.0",
|
||||
"np": "^8.0.4",
|
||||
"typescript": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"baseBranches": ["develop"],
|
||||
"labels": ["type/dependencies"]
|
||||
"baseBranches": ["develop"]
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export default class CardMetadataFunction {
|
|||
private static async FindMetadataJSONs(): Promise<SeriesMetadata[]> {
|
||||
const res: SeriesMetadata[] = [];
|
||||
|
||||
const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, 'cards', '/**/*.json'));
|
||||
const seriesJSONs = await glob(path.join(process.cwd(), 'cards', '/**/*.json'));
|
||||
|
||||
for (let jsonPath of seriesJSONs) {
|
||||
console.log(`Reading file ${jsonPath}`);
|
||||
|
|
|
@ -14,7 +14,6 @@ const requiredConfigs: string[] = [
|
|||
"BOT_OWNERID",
|
||||
"BOT_CLIENTID",
|
||||
"BOT_ENV",
|
||||
"DATA_DIR",
|
||||
"DB_HOST",
|
||||
"DB_PORT",
|
||||
"DB_AUTH_USER",
|
||||
|
@ -40,7 +39,7 @@ Registry.RegisterCommands();
|
|||
Registry.RegisterEvents();
|
||||
Registry.RegisterButtonEvents();
|
||||
|
||||
if (!existsSync(`${process.env.DATA_DIR}/cards`) && process.env.GDRIVESYNC_AUTO && process.env.GDRIVESYNC_AUTO == 'true') {
|
||||
if (!existsSync(`${process.cwd()}/cards`) && process.env.GDRIVESYNC_AUTO && process.env.GDRIVESYNC_AUTO == 'true') {
|
||||
console.log("Card directory not found, syncing...");
|
||||
|
||||
CoreClient.AllowDrops = false;
|
||||
|
|
|
@ -31,7 +31,7 @@ export default class Reroll extends ButtonEvent {
|
|||
let image: Buffer;
|
||||
const imageFileName = randomCard.card.path.split("/").pop()!;
|
||||
|
||||
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', randomCard.card.path));
|
||||
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ export default class Drop extends Command {
|
|||
let image: Buffer;
|
||||
const imageFileName = randomCard.card.path.split("/").pop()!;
|
||||
|
||||
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', randomCard.card.path));
|
||||
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ export default class Gdrivesync extends Command {
|
|||
|
||||
CoreClient.AllowDrops = false;
|
||||
|
||||
exec(`rclone sync card-drop-gdrive: ${process.env.DATA_DIR}/cards`, async (error: ExecException | null) => {
|
||||
exec(`rclone sync card-drop-gdrive: ${process.cwd()}/cards`, async (error: ExecException | null) => {
|
||||
if (error) {
|
||||
await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`);
|
||||
await Config.SetValue('safemode', 'true');
|
||||
|
|
|
@ -47,7 +47,7 @@ export default class Dropnumber extends Command {
|
|||
const imageFileName = card.path.split("/").pop()!;
|
||||
|
||||
try {
|
||||
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', card.path));
|
||||
image = readFileSync(path.join(process.cwd(), 'cards', card.path));
|
||||
} catch {
|
||||
await interaction.reply(`Unable to fetch image for card ${card.id}`);
|
||||
return;
|
||||
|
|
|
@ -50,7 +50,7 @@ export default class Droprarity extends Command {
|
|||
const imageFileName = card.card.path.split("/").pop()!;
|
||||
|
||||
try {
|
||||
image = readFileSync(path.join(process.env.DATA_DIR!, 'cards', card.card.path));
|
||||
image = readFileSync(path.join(process.cwd(), 'cards', card.card.path));
|
||||
} catch {
|
||||
await interaction.reply(`Unable to fetch image for card ${card.card.id}`);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue