feat: Archivum skeleton — Go/GraphQL backend + Vue 3 PWA frontend

Full project scaffold: multi-stage Dockerfile (ARM64/AMD64), AsciiDoc↔TipTap
bridge, Setup Wizard, CodeMirror source editor, Git-backed storage layer,
LDAP+JWT auth skeleton, Tailwind mobile-first layout, and VS Code build/push
tasks targeting registry at 192.168.0.19:5000.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 13:07:01 +02:00
parent 3db6fec664
commit e6b64e3344
35 changed files with 1882 additions and 74 deletions

View File

@@ -0,0 +1,61 @@
package config
import (
"encoding/json"
"errors"
"os"
)
// Config holds all backend runtime configuration.
type Config struct {
StoragePath string `json:"storage_path"`
DBPath string `json:"db_path"`
LDAP LDAPConfig `json:"ldap"`
JWTSecret string `json:"jwt_secret"`
ListenAddr string `json:"listen_addr"`
}
type LDAPConfig struct {
Host string `json:"host"`
Port int `json:"port"`
BaseDN string `json:"base_dn"`
BindDN string `json:"bind_dn"`
BindPassword string `json:"bind_password"`
}
// ErrRequireSetup is returned when config is missing or empty,
// signalling that the frontend should start the Setup Wizard.
var ErrRequireSetup = errors.New("REQUIRE_SETUP")
func Load(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil, ErrRequireSetup
}
return nil, err
}
var cfg Config
if err := json.Unmarshal(data, &cfg); err != nil {
return nil, err
}
if cfg.StoragePath == "" || cfg.JWTSecret == "" {
return nil, ErrRequireSetup
}
if cfg.ListenAddr == "" {
cfg.ListenAddr = ":4000"
}
return &cfg, nil
}
func Save(path string, cfg *Config) error {
data, err := json.MarshalIndent(cfg, "", " ")
if err != nil {
return err
}
return os.WriteFile(path, data, 0600)
}