Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ca1bf798e | |||
| 24dbb16ad7 | |||
| e037333da1 | |||
| ffa982eb74 | |||
| 6c0c15d3fa | |||
| d8fc36bffb | |||
| f516f0cf00 | |||
| 1253471fc3 | |||
| 77d992720d | |||
| eed6a9d9f6 | |||
| 9dc1cf10c7 | |||
| 70e21fd118 | |||
| 4c06e3fbbd | |||
| 28529158e5 | |||
| 13dbb86d38 | |||
| 504773b1ca | |||
| 659bd70c75 |
45
.gitea/workflows/compile.yml
Normal file
45
.gitea/workflows/compile.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Compile
|
||||
run-name: Compiling software (Ubuntu)
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Compile:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
env:
|
||||
POSTGRES_DB: fgbot_db
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: test_password
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Ruby and Bundler
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y ruby-full libsodium-dev libpq-dev
|
||||
gem install bundler
|
||||
|
||||
- name: Install dependencies
|
||||
run: bundle install
|
||||
|
||||
- name: Execute program
|
||||
env:
|
||||
BOT_TOKEN: ${{ secrets.TOKEN }}
|
||||
TEST_SERVER_ID: ${{ secrets.SERVER_ID }}
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_USER: postgres
|
||||
DB_PASS: test_password
|
||||
DB_NAME: fgbot_db
|
||||
run: bundle exec ruby main.rb
|
||||
@@ -19,7 +19,11 @@ require 'pg'
|
||||
class Database
|
||||
def initialize
|
||||
# Connect once when the bot starts
|
||||
@conn = PG.connect(dbname: 'fgbot_db')
|
||||
@conn = PG.connect(
|
||||
host: ENV['DB_HOST'] || 'localhost',
|
||||
dbname: ENV['DB_NAME'] || 'fgbot_db',
|
||||
user: ENV['DB_USER'] || 'postgres'
|
||||
)
|
||||
|
||||
init_tables
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user