Skip to main content

ForgejoConfig

Struct ForgejoConfig 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§host: String

Forge 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: Url

The 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: String

The bot user’s login (acme-vgi-bot). The token must belong to it.

§oauth_client_id: String

The bridge’s OAuth2 application on this instance (confidential).

§bind_redirect_uri: Url

Redirect URI for namespace binds (registered on the OAuth app).

§link_redirect_uri: Url

Redirect 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: String

The org team the bot is put in.

§checkout_action: String

uses: for checkout in the generated workflow: a full URL pinned to a 40-hex commit.

§actions_base: Url

Base URL for a bare owner/repo[/path]@sha verify-trust reference.

§runs_on: String

The 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: MergeFallback

What to do on an instance without fast-forward-only merges.

§use_actions_variables: bool

Deliver 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: Duration

Per-request timeout.

§link_state_ttl: Duration

How long an account-link state stays valid.

Implementations§

Source§

impl ForgejoConfig

Source

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.

Source

pub fn with_host(self, host: impl Into<String>) -> Self

Name resources on this instance with host instead of the URL’s.

Source

pub fn with_webhook_url(self, url: Url) -> Self

Have the bind create (or update) an org webhook to url.

Source

pub fn with_status_check_context(self, context: impl Into<String>) -> Self

Require this status-check context instead of the derived one.

Source

pub fn with_merge_fallback(self, fallback: MergeFallback) -> Self

Choose the fallback for instances without fast-forward-only merges.

Source

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).

Source

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.

Trait Implementations§

Source§

impl Clone for ForgejoConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ForgejoConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more