package config

import (
	"time"

	"git.schreifuchs.ch/schreifuchs/ng-blog/internal/auth"
)

// Config holds configuration settings for the application, loaded from environment variables.
type Config struct {
	Port   int         `env:"PORT"`
	Host   string      `env:"HOST"`
	DBPath string      `env:"DB_PATH"`
	Auth   auth.Config `env:"AUTH"`
}

// Default returns a default configuration with pre-defined values.
func Default() *Config {
	return &Config{
		Port:   8080,
		Host:   "localhost",
		DBPath: "./blog.db",
		Auth: auth.Config{
			Secret:        "secret",
			ValidDuration: time.Hour * 1,
			AdminName:     "admin",
			AdminPassword: "admin",
		},
	}
}
