Compare commits

..

No commits in common. "625e4b570b523e731aaca72a9c9d53eb0c5ad7af" and "ad30583265f838edd60f3ce2026db60de0f9df96" have entirely different histories.

4 changed files with 2 additions and 35 deletions

View File

@ -16,14 +16,6 @@ steps:
tags:
- latest
- main
- name: continuous deployment
image: alpine:latest
commands:
- apk add -y openssh
- sh deploy.sh
environment:
SSH_KEY:
from_secret: SSH_KEY
trigger:
branch:
- main

View File

@ -66,19 +66,11 @@ func IdContinuation(context *RequestContext, req *http.Request, resp http.Respon
}
}
func CacheControlMiddleware(next http.Handler, maxAge int) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
header := fmt.Sprintf("public, max-age=%d", maxAge)
w.Header().Set("Cache-Control", header)
next.ServeHTTP(w, r)
})
}
func MakeServer(argv *args.Arguments, dbConn *sql.DB) *http.Server {
mux := http.NewServeMux()
fileServer := http.FileServer(http.Dir(argv.StaticPath))
mux.Handle("/static/", http.StripPrefix("/static/", CacheControlMiddleware(fileServer, 3600)))
mux.Handle("GET /static/", http.StripPrefix("/static/", fileServer))
makeRequestContext := func() *RequestContext {
return &RequestContext{

View File

@ -59,17 +59,10 @@ func MigrateDNSRecords(dbConn *sql.DB) (*sql.DB, error) {
ttl INTEGER NOT NULL,
internal BOOLEAN NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
);`)
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE);`)
if err != nil {
return dbConn, err
}
_, err = dbConn.Exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_dns_records_name_content_type ON dns_records (name, type, content);`)
if err != nil {
return dbConn, err
}
return dbConn, nil
}

View File

@ -1,10 +0,0 @@
#!/bin/bash
set -e
echo $SSH_KEY | base64 -d >> /tmp/key
chmod -R 0600 /tmp/key
ssh -i /tmp/key -o StrictHostKeyChecking=no root@hatecomputers.club "systemctl restart docker-compose@hatecomputers-club"
rm /tmp/key