refactor: project structure

This commit is contained in:
trafficlunar 2025-12-15 16:59:04 +00:00
parent 0942761cd8
commit b6cf11f680
11 changed files with 23 additions and 18 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
themes/*.css linguist-detectable=false

View file

@ -3,3 +3,4 @@
- [ ] View incidents
- [ ] Latency graphs?
- [ ] README
- [ ] Site metadata

2
go.mod
View file

@ -1,4 +1,4 @@
module status-page
module statsys
go 1.25.4

View file

@ -1,4 +1,4 @@
package main
package internal
import (
"log"

View file

@ -1,4 +1,4 @@
package main
package internal
import (
"database/sql"
@ -12,7 +12,7 @@ import (
var STATUS_PRIORITY = map[string]int{"Offline": 2, "Degraded": 1, "Online": 0}
var db *sql.DB
func InitializeDatabase() {
func InitDatabase() {
// open/create database
var err error
db, err = sql.Open("sqlite", "status.db")

View file

@ -1,4 +1,4 @@
package main
package internal
import (
"html/template"

View file

@ -1,4 +1,4 @@
package main
package internal
import (
"log"

11
main.go Normal file
View file

@ -0,0 +1,11 @@
package main
import "statsys/internal"
func main() {
internal.LoadConfig()
internal.InitDatabase()
defer internal.CloseDatabase()
internal.StartCheckingStatuses()
internal.StartHttpServer()
}

View file

@ -1,9 +0,0 @@
package main
func main() {
LoadConfig()
InitializeDatabase()
defer CloseDatabase()
StartCheckingStatuses()
StartHttpServer()
}

View file

@ -18,6 +18,7 @@
flex-direction: column;
width: 100%;
height: max-content;
min-height: 100%;
max-width: 40rem;
padding: 4rem 2rem 1.5rem;
background-color: white;

View file

@ -86,7 +86,7 @@ hr {
}
.status-bar.Unknown {
background: radial-gradient(circle at center, #94a3b8 3px, transparent 3px);
background: radial-gradient(circle at center, rgba(0, 0, 0, 0.1) 3px, transparent 3px);
}
.bars-footer {
@ -111,7 +111,7 @@ footer a:hover {
}
.combobox-trigger {
background-color: white;
background-color: #f8fafc;
border: 1px solid rgba(15, 23, 42, 0.4);
}
@ -124,7 +124,7 @@ footer a:hover {
}
.combobox-dropdown {
background-color: white;
background-color: #f8fafc;
border: 1px solid rgba(15, 23, 42, 0.4);
}