feat: Gitea backend refactoring (#833)
This commit is contained in:
@ -17,7 +17,7 @@ Individual backends provide their own configuration documentation, but there are
|
||||
| branch | string | `main` | _Optional_. The branch where published content is stored. All CMS commits and PRs are made to this branch |
|
||||
| api_root | string | GitHub<br />`https://api.github.com`<br /><br />GitLab<br/>`https://gitlab.com/api/v4`<br /><br />Bitbucket<br />`https://api.bitbucket.org/2.0`<br /><br />Gitea<br />`https://try.gitea.io/api/v1` | _Optional_. The API endpoint. Only necessary in certain cases, like with GitHub Enterprise or self-hosted GitLab |
|
||||
| site_domain | string | `location.hostname`<br /><br />On `localhost`<br />`cms.netlify.com` | _Optional_. Sets the `site_id` query param sent to the API endpoint. Non-Netlify auth setups will often need to set this for local development to work properly |
|
||||
| base_url | string | GitHub or Bitbucket<br />`https://api.netlify.com`<br /><br />GitLab<br />`https://gitlab.com` | _Optional_. OAuth client hostname (just the base domain, no path). **Required** when using an external OAuth server or self-hosted GitLab/Gitea |
|
||||
| base_url | string | GitHub or Bitbucket<br />`https://api.netlify.com`<br /><br />GitLab<br />`https://gitlab.com`<br /><br />Gitea<br />`https://try.gitea.io` | _Optional_. OAuth client hostname (just the base domain, no path). **Required** when using an external OAuth server or self-hosted GitLab/Gitea |
|
||||
| auth_endpoint | string | GitHub or Bitbucket<br />`auth`<br /><br />GitLab<br />`oauth/authorize` | _Optional_. Path to append to `base_url` for authentication requests. |
|
||||
|
||||
## Creating a New Backend
|
||||
|
@ -9,24 +9,23 @@ beta: true
|
||||
|
||||
For repositories stored on Gitea, the `gitea` backend allows CMS users to log in directly with their Gitea account. Note that all users must have push access to your content repository for this to work.
|
||||
|
||||
<Alert severity="warning">Because of the [lack](https://github.com/go-gitea/gitea/issues/14619) of a Gitea API endpoint for multifile commits, when using this backend, separate commits are created for every changed file. Please make sure this is handled correctly by your CI.</Alert>
|
||||
Please note that only Gitea **1.20** and upwards is supported due to API limitations in previous versions.
|
||||
|
||||
## Authentication
|
||||
|
||||
Because Gitea requires a server for authentication and Netlify doesn't support Gitea, a custom OAuth provider needs to be used for basic Gitea authentication.
|
||||
With Gitea's PKCE authorization, users can authenticate with Gitea directly from the client. To do this:
|
||||
|
||||
To enable basic Gitea authentication:
|
||||
|
||||
1. Setup an own OAuth provider, for example with [Teabag](https://github.com/denyskon/teabag).
|
||||
2. Add the following lines to your Static CMS `config` file:
|
||||
1. Add your Static CMS instance as an OAuth application in your user/organization settings or through the admin panel of your Gitea instance. Please make sure to uncheck the **Confidential Client** checkbox. For the **Redirect URIs**, enter the addresses where you access Static CMS, for example, `https://www.mysite.com/admin/`.
|
||||
2. Gitea provides you with a **Client ID**. Copy it and insert it into your `config` file along with the other options:
|
||||
|
||||
<CodeTabs>
|
||||
```yaml
|
||||
backend:
|
||||
name: gitea
|
||||
repo: owner-name/repo-name # Path to your Gitea repository
|
||||
base_url: https://oauth.example.com # URL of your OAuth provider
|
||||
api_root: https://gitea.example.com/api/v1 # API url of your Gitea instance
|
||||
app_id: your-client-id # The Client ID provided by Gitea
|
||||
api_root: https://gitea.example.com/api/v1 # API URL of your Gitea instance
|
||||
base_url: https://gitea.example.com # Root URL of your Gitea instance
|
||||
# optional, defaults to main
|
||||
# branch: main
|
||||
```
|
||||
@ -35,8 +34,9 @@ backend:
|
||||
backend: {
|
||||
name: 'gitea',
|
||||
repo: 'owner-name/repo-name', // Path to your Gitea repository
|
||||
base_url: 'https://oauth.example.com', // URL of your OAuth provider
|
||||
api_root: 'https://gitea.example.com/api/v1' // API url of your Gitea instance
|
||||
app_id: 'your-client-id', // The Client ID provided by Gitea
|
||||
api_root: 'https://gitea.example.com/api/v1', // API URL of your Gitea instance
|
||||
base_url: 'https://gitea.example.com', // Root URL of your Gitea instance
|
||||
// optional, defaults to main
|
||||
// branch: 'main'
|
||||
},
|
||||
|
Reference in New Issue
Block a user