Documentation
¶
Overview ¶
Package forgejo provisions a git.profullstack.com account for every verified AgentBBS member (free and paid alike) on the self-hosted Forgejo backend that powers AgentGit. BBS membership *is* the git account: when a member verifies their email, EnsureUser creates the matching Forgejo user. It is idempotent — an existing account is left untouched. When unconfigured (no admin token) Configured() reports false and callers skip provisioning entirely.
This mirrors the AgentGit ForgejoAdapter.ensureUser contract in profullstack/logicsrc (plugins/agentgit). Plan (free vs. premium) never affects whether the account exists — only quotas, which are enforced server-side by AgentGit merge policy, not here.
Config (env):
AGENTBBS_FORGEJO_URL base URL, e.g. https://git.profullstack.com AGENTBBS_FORGEJO_ADMIN_TOKEN Forgejo admin access token
Index ¶
- type Config
- func (c Config) Configured() bool
- func (c Config) EnsureKey(username, title, pubKey string) (added bool, err error)
- func (c Config) EnsureUser(username, email string) (created bool, password string, err error)
- func (c Config) EnsureUserReset(username, email string) (created bool, password string, err error)
- func (c Config) LoginURL() string
- func (c Config) SetPassword(username, password string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config holds the Forgejo base URL and admin token.
func ConfigFromEnv ¶
func ConfigFromEnv() Config
ConfigFromEnv reads the Forgejo settings from the environment.
func (Config) Configured ¶
Configured reports whether accounts can actually be provisioned.
func (Config) EnsureKey ¶ added in v0.1.1
EnsureKey registers an SSH public key on the member's Forgejo account so the key they use for the BBS is also their git push key ("BBS membership is the git account"). It is idempotent: added is false when the same key material is already present. A blank key is a no-op. title labels the key in Forgejo.
func (Config) EnsureUser ¶
EnsureUser creates a Forgejo account for username (forwarding to email) if it does not already exist. It is idempotent: created is false (and password "") when the account was already present. New accounts get a generated temporary password with must_change_password set; the caller emails it to the member so they can sign in to the web UI once and set their own. Git over SSH still uses their registered key.
func (Config) EnsureUserReset ¶ added in v0.1.1
EnsureUserReset creates the account if missing, or resets an existing account's password to a fresh temporary one with must_change_password set. Unlike EnsureUser it always returns a usable password — even for accounts that already exist (whose original one-time password we no longer hold). created reports whether the account was newly made. Used by the notify-creds re-send so every member receives working web credentials.
func (Config) LoginURL ¶ added in v0.1.1
LoginURL is the web sign-in page members are pointed at in their welcome email, e.g. https://git.profullstack.com/user/login.
func (Config) SetPassword ¶ added in v0.1.1
SetPassword sets an existing account's password to the member-chosen value and clears must_change_password (they picked it, so don't force another change on next sign-in). Unlike EnsureUserReset it never generates a password and never creates the account: the caller is a member resetting their own credential across services, and the Forgejo account is expected to already exist (it is created at email-verification time). A missing account is reported as an error so the caller can surface "no git account yet" rather than silently succeeding.