Better developer feedback

This commit is contained in:
Imbus 2024-03-08 10:25:22 +01:00
parent d4a2a00f69
commit b52f13ee8b

View file

@ -1,13 +1,14 @@
package main package main
import ( import (
"encoding/json"
"fmt" "fmt"
"os"
_ "ttime/docs" _ "ttime/docs"
"ttime/internal/config" "ttime/internal/config"
"ttime/internal/database" "ttime/internal/database"
"ttime/internal/handlers" "ttime/internal/handlers"
"github.com/BurntSushi/toml"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/swagger" "github.com/gofiber/swagger"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
@ -35,9 +36,11 @@ func main() {
_ = conf.WriteConfigToFile("config.toml") _ = conf.WriteConfigToFile("config.toml")
} }
// Pretty print the current config // Pretty print the current config with toml
str, _ := json.MarshalIndent(conf, "", " ") toml.NewEncoder(os.Stdout).Encode(conf)
fmt.Println(string(str))
fmt.Printf("Starting server on http://localhost:%d\n", conf.Port)
fmt.Printf("For documentation, go to http://localhost:%d/swagger/index.html\n", conf.Port)
// Connect to the database // Connect to the database
db := database.DbConnect(conf.DbPath) db := database.DbConnect(conf.DbPath)