made cross-platform development easier

Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
ari melody 2024-03-20 07:14:05 +00:00
parent 4b5e6a50ff
commit 9d56ca63af
5 changed files with 85 additions and 22 deletions

46
.air.toml Normal file
View file

@ -0,0 +1,46 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = false
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
keep_scroll = true

3
.gitignore vendored
View file

@ -1,3 +1,2 @@
**/.DS_Store **/.DS_Store
**/*.ps1 tmp/
**/*.sh

2
db.go
View file

@ -80,7 +80,7 @@ func PushAlbum(db *sqlx.DB, album music.Album) {
} }
func InitDatabase() *sqlx.DB { func InitDatabase() *sqlx.DB {
db, err := sqlx.Connect("postgres", "user=arimimi dbname=arimelody password=fuckingpassword sslmode=disable") db, err := sqlx.Connect("postgres", "user=arimelody dbname=arimelody password=fuckingpassword sslmode=disable")
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "unable to create database connection pool: %v\n", err) fmt.Fprintf(os.Stderr, "unable to create database connection pool: %v\n", err)
os.Exit(1) os.Exit(1)

18
docker-compose-db.yml Normal file
View file

@ -0,0 +1,18 @@
version: '3.9'
services:
db:
image: postgres:16.1-alpine3.18
container_name: arimelody.me-db
ports:
- 5432:5432
volumes:
- arimelody-db:/var/lib/postgresql/data
environment:
POSTGRES_DB: arimelody
POSTGRES_USER: arimelody
POSTGRES_PASSWORD: fuckingpassword
volumes:
arimelody-db:
external: true

10
main.go
View file

@ -1,16 +1,16 @@
package main package main
import ( import (
"arimelody.me/arimelody.me/api/v1/music"
"fmt" "fmt"
"html/template" "html/template"
"os"
"net/http"
"log" "log"
"net/http"
"os"
"strconv"
"strings" "strings"
"time" "time"
"strconv"
"arimelody.me/arimelody.me/api/v1/music"
"github.com/gomarkdown/markdown" "github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/html" "github.com/gomarkdown/markdown/html"