#[non_exhaustive]pub struct ForgejoConfig {Show 17 fields
pub host: String,
pub base_url: Url,
pub bot_login: String,
pub oauth_client_id: String,
pub bind_redirect_uri: Url,
pub link_redirect_uri: Url,
pub oauth_scope: Option<String>,
pub webhook_url: Option<Url>,
pub team_name: String,
pub checkout_action: String,
pub actions_base: Url,
pub runs_on: String,
pub status_check_context: Option<String>,
pub merge_fallback: MergeFallback,
pub use_actions_variables: bool,
pub request_timeout: Duration,
pub link_state_ttl: Duration,
}Expand description
How to reach one Forgejo (or Gitea) instance as one bot user.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.host: StringForge host resources on this instance start with: codeberg.org,
git.example.org. Derived from base_url; override it only when
the bridge reaches the instance through another name.
base_url: UrlThe instance’s root URL, e.g. https://codeberg.org/ (or
https://example.org/git/ under a sub-path). The API is
<base_url>/api/v1; OAuth lives under <base_url>/login/oauth.
bot_login: StringThe bot user’s login (acme-vgi-bot). The token must belong to it.
oauth_client_id: StringThe bridge’s OAuth2 application on this instance (confidential).
bind_redirect_uri: UrlRedirect URI for namespace binds (registered on the OAuth app).
link_redirect_uri: UrlRedirect URI for account links (registered on the OAuth app).
oauth_scope: Option<String>OAuth scope to request, when the instance grants scoped OAuth
tokens ([oauth2] ENABLE_ADDITIONAL_GRANT_SCOPES). None asks for
no scope: such a token has the admin’s (or member’s) full access, so
the adapter uses it for a handful of calls and wipes it.
webhook_url: Option<Url>Where the instance delivers the org webhook (the bridge). None
creates no webhook; drift is then found by the scheduled sweep only.
team_name: StringThe org team the bot is put in.
checkout_action: Stringuses: for checkout in the generated workflow: a full URL pinned to
a 40-hex commit.
actions_base: UrlBase URL for a bare owner/repo[/path]@sha verify-trust reference.
runs_on: StringThe runner label (runs-on:). The job image needs glibc 2.39+
(Ubuntu 24.04, Debian 13) for the verify-trust Linux binary.
status_check_context: Option<String>The status-check context branch protection requires. Forgejo names a
job’s status <workflow name> / <job name> (<event>); None derives
it from the check name the plan gives both, i.e. Verify commit trust / Verify commit trust (pull_request). Set it when a completed run
reports something else.
merge_fallback: MergeFallbackWhat to do on an instance without fast-forward-only merges.
use_actions_variables: boolDeliver TRUST_REGISTRY_DID / VTC_DID as Actions variables rather
than writing them into the workflow. Off by default, for two reasons:
Forgejo lets only a repository owner (the org’s Owners team) manage
variables, which the bot — an admin through its team — is not; and a
value in the workflow can only change through a pull request, which
the protected paths refuse, while an owner can re-point a variable at
another registry without one. Turn it on only if the bot is an owner.
request_timeout: DurationPer-request timeout.
link_state_ttl: DurationHow long an account-link state stays valid.
Implementations§
Source§impl ForgejoConfig
impl ForgejoConfig
Sourcepub fn new(
base_url: Url,
bot_login: impl Into<String>,
oauth_client_id: impl Into<String>,
bind_redirect_uri: Url,
link_redirect_uri: Url,
) -> Result<Self>
pub fn new( base_url: Url, bot_login: impl Into<String>, oauth_client_id: impl Into<String>, bind_redirect_uri: Url, link_redirect_uri: Url, ) -> Result<Self>
An instance at base_url, with the bot and OAuth app named.
Plain http is refused except on a loopback host: the bot token is
long-lived and travels on every request.
Sourcepub fn with_host(self, host: impl Into<String>) -> Self
pub fn with_host(self, host: impl Into<String>) -> Self
Name resources on this instance with host instead of the URL’s.
Sourcepub fn with_webhook_url(self, url: Url) -> Self
pub fn with_webhook_url(self, url: Url) -> Self
Have the bind create (or update) an org webhook to url.
Sourcepub fn with_status_check_context(self, context: impl Into<String>) -> Self
pub fn with_status_check_context(self, context: impl Into<String>) -> Self
Require this status-check context instead of the derived one.
Sourcepub fn with_merge_fallback(self, fallback: MergeFallback) -> Self
pub fn with_merge_fallback(self, fallback: MergeFallback) -> Self
Choose the fallback for instances without fast-forward-only merges.
Sourcepub fn with_actions_variables(self) -> Self
pub fn with_actions_variables(self) -> Self
Deliver the DIDs as Actions variables (see
ForgejoConfig::use_actions_variables: needs the bot to be an owner).
Sourcepub fn status_context(&self, check: &str) -> String
pub fn status_context(&self, check: &str) -> String
The status context for a job named check in a workflow of the same
name, triggered by pull_request.