add docker files & nginx config

This commit is contained in:
2025-12-18 14:04:14 +03:00
parent f1a65f2fe4
commit 797c53bfca
13 changed files with 4300 additions and 950 deletions

View File

@@ -69,9 +69,7 @@ func sendApiError(w http.ResponseWriter, msg string, err error, status int) {
var jwtSecretKey []byte
func init() {
if err := godotenv.Load(); err != nil {
panic("couldn't parse env")
}
godotenv.Load()
s := os.Getenv("JWT_SECRET")
if s == "" {
@@ -143,7 +141,12 @@ func handler(mux *http.ServeMux) http.HandlerFunc {
func main() {
flag.Parse()
db, err := sqlx.Connect("sqlite3", "./sqlite.db")
dbPath := os.Getenv("DB_PATH")
if dbPath == "" {
panic("no DB_PATH env")
}
db, err := sqlx.Connect("sqlite3", dbPath)
if err != nil {
log.Fatalf("failed to connect to db: %v\n", err)
}