chore: initial project structure
This commit is contained in:
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Binaries
|
||||||
|
*.exe
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.test
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Go
|
||||||
|
vendor/
|
||||||
|
go.sum
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
25
README.md
Normal file
25
README.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# MrixsCraft Server
|
||||||
|
|
||||||
|
Minecraft серверная часть на Go (net/http + PostgreSQL).
|
||||||
|
|
||||||
|
## Сборка
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go build -o mrixscraft-server ./cmd/server
|
||||||
|
```
|
||||||
|
|
||||||
|
## Запуск
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export SERVER_PORT=8080
|
||||||
|
export DATABASE_URL="postgres://user:pass@localhost:5432/mrixscraft"
|
||||||
|
|
||||||
|
go run ./cmd/server
|
||||||
|
```
|
||||||
|
|
||||||
|
## Переменные окружения
|
||||||
|
|
||||||
|
| Переменная | Описание | По умолчанию |
|
||||||
|
|------------|----------|--------------|
|
||||||
|
| `SERVER_PORT` | Порт HTTP-сервера | `8080` |
|
||||||
|
| `DATABASE_URL` | DSN PostgreSQL | — |
|
||||||
26
cmd/server/main.go
Normal file
26
cmd/server/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
port := os.Getenv("SERVER_PORT")
|
||||||
|
if port == "" {
|
||||||
|
port = "8080"
|
||||||
|
}
|
||||||
|
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
fmt.Fprintln(w, "ok")
|
||||||
|
})
|
||||||
|
|
||||||
|
log.Printf("MrixsCraft Server starting on :%s", port)
|
||||||
|
if err := http.ListenAndServe(":"+port, mux); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
2
internal/admin/admin.go
Normal file
2
internal/admin/admin.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// package admin implements admin panel endpoints (modpack management, CI/CD release).
|
||||||
|
package admin
|
||||||
3
internal/api/api.go
Normal file
3
internal/api/api.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Package api implements public HTTP endpoints for the launcher and website.
|
||||||
|
package api
|
||||||
|
|
||||||
2
internal/auth/auth.go
Normal file
2
internal/auth/auth.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// Package auth implements Yggdrasil authentication protocol.
|
||||||
|
package auth
|
||||||
2
internal/cas/cas.go
Normal file
2
internal/cas/cas.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// package cas implements Content-Addressable Storage for files (mods, assets, etc).
|
||||||
|
package cas
|
||||||
2
internal/config/config.go
Normal file
2
internal/config/config.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// package config handles server configuration (env vars, config files).
|
||||||
|
package config
|
||||||
2
internal/database/database.go
Normal file
2
internal/database/database.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// package database manages PostgreSQL connections, migrations, and data models.
|
||||||
|
package database
|
||||||
2
internal/middleware/middleware.go
Normal file
2
internal/middleware/middleware.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// package middleware provides HTTP middleware (JWT, CORS, rate limiting, logging).
|
||||||
|
package middleware
|
||||||
2
internal/templates/templates.go
Normal file
2
internal/templates/templates.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// package templates handles Go html/template rendering for the site and admin panel.
|
||||||
|
package templates
|
||||||
2
pkg/utils/utils.go
Normal file
2
pkg/utils/utils.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// package utils provides shared utility functions (SHA-1, ZIP, etc.).
|
||||||
|
package utils
|
||||||
Reference in New Issue
Block a user