implemented start server

This commit is contained in:
Hazel Noack
2025-07-16 12:31:47 +02:00
parent f574a00a8f
commit 94b3f4c0f2
3 changed files with 16 additions and 110 deletions

View File

@@ -1,8 +1,18 @@
package cli
import "log"
import (
"log"
"os"
"gitea.elara.ws/Hazel/transfem-startpage/internal/server"
)
func Start() error {
log.Println("starting server")
return nil
profile := "default"
if len(os.Args) > 2 {
profile = os.Args[2]
}
log.Println("starting server with profile " + profile)
return server.Start(profile)
}

View File

@@ -3,10 +3,8 @@ package rendering
import (
"errors"
"fmt"
"maps"
"os"
"path/filepath"
"slices"
"gitea.elara.ws/Hazel/transfem-startpage/internal/diyhrt"
"github.com/pelletier/go-toml"
@@ -102,17 +100,6 @@ func NewConfig() Config {
}
}
func (c *Config) LoadDiyHrt(listings []diyhrt.Listing) {
existingStores := make(map[int]diyhrt.Store)
for _, listing := range listings {
existingStores[listing.Store.Id] = listing.Store
}
c.Template.Listings = c.DiyHrt.ListingFilter.Filter(listings)
c.Template.Stores = c.DiyHrt.StoreFilter.Filter(slices.Collect(maps.Values(existingStores)))
}
func (rc *Config) ScanForConfigFile(profile string) error {
profileFile := profile + ".toml"