git-svn-id: svn://losandesgames.com/alfheim-website@47 15359d88-9307-4e75-a9c1-e5686e5897df
This commit is contained in:
parent
db8c61da56
commit
cb3199966c
19
Makefile
19
Makefile
@ -1,10 +1,12 @@
|
||||
svn_revision = $(svn info --show-item revision)
|
||||
|
||||
build:
|
||||
@echo "Building the website..."
|
||||
rm -rf bin
|
||||
mkdir bin
|
||||
mkdir bin/static
|
||||
mkdir bin/ui
|
||||
go build -o bin/alfheim-website
|
||||
go build -ldflags="-s -X main.version=$(svn_revision)" -o bin/alfheim-website ./cmd/web
|
||||
cp -r ui bin
|
||||
cp -r static bin
|
||||
cp favicon.ico bin
|
||||
@ -12,7 +14,7 @@ build:
|
||||
mkdir bin/linux_amd64
|
||||
mkdir bin/linux_amd64/static
|
||||
mkdir bin/linux_amd64/ui
|
||||
GOOS=linux GOARCH=amd64 go build -o bin/linux_amd64/alfheim-website
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags="-s -X main.version=$(svn_revision)" -o bin/linux_amd64/alfheim-website ./cmd/web
|
||||
cp -r ui bin/linux_amd64
|
||||
cp -r static bin/linux_amd64
|
||||
cp favicon.ico bin/linux_amd64
|
||||
@ -22,11 +24,12 @@ run:
|
||||
@echo "Running the website..."
|
||||
go run ./*.go
|
||||
|
||||
.PHONY: deploy
|
||||
deploy:
|
||||
.PHONY: production/deploy
|
||||
production/deploy:
|
||||
rsync -rP --delete bin/linux_amd64 alfheim@alfheimgame.com:/home/alfheim
|
||||
|
||||
.PHONY: service
|
||||
service:
|
||||
rsync -P alfheim-website.service alfheim@alfheimgame.com:/home/alfheim
|
||||
rsync -P remote/production/alfheim-website.service alfheim@alfheimgame.com:/home/alfheim
|
||||
ssh -t root@alfheimgame.com 'mv /home/alfheim/alfheim-website.service /etc/systemd/system && systemctl enable alfheim-website && systemctl restart alfheim-website'
|
||||
|
||||
.PHONY: production/connect
|
||||
production/connect:
|
||||
ssh alfheim@losandesgames.com
|
||||
|
||||
@ -6,6 +6,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
@ -27,14 +28,25 @@ var store = sessions.NewCookieStore(key)
|
||||
|
||||
var emailrx = regexp.MustCompile("/^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/")
|
||||
|
||||
var version string
|
||||
|
||||
func main() {
|
||||
addr := flag.String("addr", "127.0.0.1:8080", "HTTP network addr")
|
||||
prodaddr := flag.String("prodaddr", "127.0.0.1:4000", "HTTP network addr")
|
||||
//prodaddr := flag.String("prodaddr", "45.76.84.7:443", "HTTP network addr")
|
||||
|
||||
production := flag.Bool("production", false, "Whether to use production port and TLS")
|
||||
|
||||
displayVersion := flag.Bool("version", false, "Display version and exit")
|
||||
|
||||
_ = addr
|
||||
flag.Parse()
|
||||
|
||||
if *displayVersion {
|
||||
fmt.Println("Version: %s", version)
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("Hello, Sailor!")
|
||||
|
||||
stripe.Key = "sk_test_51PGebgKUHKCjyTmc97rfDPcvew6EhqDz2qp3U7XoAMIilAU9IVo2NO4P7ylkTvbBafFVr94trha1VYY32jRWMw2K00Yq7YJXFf"
|
||||
|
||||
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module alfheimgame.com/alfheim
|
||||
|
||||
go 1.25.1
|
||||
go 1.24
|
||||
|
||||
require (
|
||||
github.com/alexedwards/argon2id v1.0.0
|
||||
|
||||
@ -58,7 +58,7 @@ type Subscription struct {
|
||||
Status SubscriptionStatus
|
||||
}
|
||||
|
||||
type Usermodel struct {
|
||||
type UserModel struct {
|
||||
DB *sql.DB
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ func (m *Usermodel) Insert(username string, password string, firstname string, l
|
||||
return insertid, nil
|
||||
}
|
||||
|
||||
func (m *Usermodel) Delete(id int32) error {
|
||||
func (m *UserModel) Delete(id int32) error {
|
||||
account, err := users.GetAccount(id)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user