← repoman internals

cmd/repoman

import "git.griefed.de/griefed/repoman/cmd/repoman"
Command repoman is the entry point for both the daemon and the CLI subcommands.

Subcommand layout (KISS — flat where possible, grouped only where it
disambiguates):

    repoman serve                        — start the HTTP daemon
    repoman run --config NAME            — one-off migration run
    repoman backup --output FILE         — consistent SQLite backup
    repoman restore --input FILE         — restore from backup
    repoman user create-admin            — bootstrap initial admin
    repoman user list                    — list all users
    repoman user lock|unlock USERNAME    — manual lockout control
    repoman user reset-password USERNAME — generate a temp password
    repoman user reset-2fa USERNAME      — clear TOTP enrolment
    repoman emergency-reset USERNAME     — last-resort admin recovery
    repoman migration-config list        — list configs
    repoman migration-config show NAME   — show one config

Persistent flags shared across subcommands:

    --db PATH        path to SQLite DB (default: ./repoman.db)
    --data-dir PATH  base for derived files: pepper, security log
                     (default: directory containing --db)
    --log-dir PATH   directory for date-rotated app + security logs
                     (default: a "logs" subdirectory of --data-dir)
    --backup-dir PATH directory for scheduled DB backups
                     (default: a "backups" subdirectory of --data-dir)
    --log-level LEVEL minimum log level: debug|info|warn|error
                     (default: info)

Every subcommand except `serve` writes a structured, secret-free audit line to
cli-*.log under --log-dir recording what was run; `serve` logs to repoman-*.log.
Human-readable command output stays on the terminal.

Every flag also falls back to an environment variable named REPOMAN_<FLAG> (the
flag name upper-cased, '-' → '_': --log-level ← REPOMAN_LOG_LEVEL, --base-url
← REPOMAN_BASE_URL, …), so a container can be configured from the environment
alone. Precedence is flag > env var > default.

Most commands take no other flags; the few that do are documented per-command.

VARIABLES

var (
	Version   = "dev"
	BuildTime = "unknown"
)
    Version and BuildTime are stamped at build time via -ldflags -X (see the
    Makefile); they keep these dev defaults for a plain `go run`/`go build`.
    Setting rootCmd.Version (in init) makes `repoman --version` report them.