File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ node_modules
44.devenv
55.env
66.envrc.local
7+
8+ .sops-key-file
Original file line number Diff line number Diff line change 11# Discord Bots
22
3- 何か書く。
3+ ## 開発
4+
5+ 特に記述することはなし
46
57## Bot追加方法
68
@@ -13,3 +15,7 @@ mkdir bots/YOUR_BOT
13152 . bots/YOUR_BOT にBotを書く
14163 . ` rollcron.yaml ` に YOUR_BOT の cron スケジュールとスクリプトを書く。
15174 . VPS にすでに実行環境がない場合は、実行環境を作る (Docker ランナーはそのうちサポートする予定)
18+
19+ ## デプロイ
20+
21+ 環境変数が必要な場合は VPS 上に variables/discord-bots/YOUR_BOT.env を用意してください。そのうち SOPS を導入するかもしれないし、しないかもしれない
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
33
4+ ENV_FILE=" ${ENV_FILE:- .env} "
45function bail() {
56 echo " $@ "
67 exit 1
78}
89
910# prerequesties
10- if [ ! -f .env ]; then
11+ if [ ! -f " $ENV_FILE " ]; then
1112 bail " Prerequesties not met: .env not found"
1213fi
1314
1415case " $1 " in
1516ask)
1617 bun install --frozen-lockfile
17- bun --env-file=.env commands/ask.ts
18+ bun --env-file=" $ENV_FILE " commands/ask.ts
1819 ;;
1920check)
2021 bun install --frozen-lockfile
21- bun --env-file=.env commands/check.ts
22+ bun --env-file=" $ENV_FILE " commands/check.ts
2223 ;;
2324* )
2425 bail " [asakatsu-bot] Unknown Command: $1 "
Original file line number Diff line number Diff line change 1616 asakatsu-bot-ask :
1717 schedule :
1818 cron : " 0 19 * * *"
19- run : run.sh ask
19+ run : ENV_FILE=~/variables/discord-bots/asakatsu-bot.env run.sh ask
2020 asakatsu-bot-check :
2121 schedule :
2222 cron : " 0 8 * * *"
23- run : run.sh check
23+ run : ENV_FILE=~/variables/discord-bots/asakatsu-bot.env run.sh check
You can’t perform that action at this time.
0 commit comments