talas-group/talas-wiki/internal/config/config.go
senke 66471934af Initial commit: Talas Group project management & documentation
Knowledge base of ~80+ markdown files across 14 domains (00-13),
Logseq graph, hardware design files (KiCAD), infrastructure configs,
and talas-wiki static site.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:10:41 +02:00

64 lines
1.4 KiB
Go

package config
import (
"os"
"strconv"
"strings"
)
type Config struct {
Port int
DocsRoot string
ExcludeDirs []string
Username string
Password string
ReadOnly bool
}
func Load() *Config {
port := 8090
if p := os.Getenv("WIKI_PORT"); p != "" {
if v, err := strconv.Atoi(p); err == nil {
port = v
}
}
docsRoot := os.Getenv("WIKI_DOCS_ROOT")
if docsRoot == "" {
docsRoot = ".."
}
excludeDirs := []string{
".claude", ".git", ".logseq", "logseq", "journals", "pages",
"13_ARCHIVES", "99_SYMLINKS", "_BROUILLON", "node_modules",
"talas-wiki",
"04_INFRA_DEPLOIEMENT/Notes_Operations/jumpserver_docs",
"02_PRODUITS_PHYSIQUES/Microphone/Conception/composants",
"02_PRODUITS_PHYSIQUES/Microphone/Conception/composants - Copie",
"02_PRODUITS_PHYSIQUES/Microphone/Conception/AliceOPA",
"02_PRODUITS_PHYSIQUES/Buyings",
}
if extra := os.Getenv("WIKI_EXCLUDE_DIRS"); extra != "" {
excludeDirs = append(excludeDirs, strings.Split(extra, ",")...)
}
username := os.Getenv("WIKI_USERNAME")
if username == "" {
username = "talas"
}
password := os.Getenv("WIKI_PASSWORD")
if password == "" {
password = "talas"
}
readOnly := os.Getenv("WIKI_READONLY") == "true"
return &Config{
Port: port,
DocsRoot: docsRoot,
ExcludeDirs: excludeDirs,
Username: username,
Password: password,
ReadOnly: readOnly,
}
}