mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-23 11:01:49 +01:00
03508b33a8
- Continuation of https://github.com/go-gitea/gitea/pull/18835 (by @Gusted, so it's fine to change copyright holder to Forgejo). - Add the option to use SSH for push mirrors, this would allow for the deploy keys feature to be used and not require tokens to be used which cannot be limited to a specific repository. The private key is stored encrypted (via the `keying` module) on the database and NEVER given to the user, to avoid accidental exposure and misuse. - CAVEAT: This does require the `ssh` binary to be present, which may not be available in containerized environments, this could be solved by adding a SSH client into forgejo itself and use the forgejo binary as SSH command, but should be done in another PR. - CAVEAT: Mirroring of LFS content is not supported, this would require the previous stated problem to be solved due to LFS authentication (an attempt was made at forgejo/forgejo#2544). - Integration test added. - Resolves #4416
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package structs
|
|
|
|
import "time"
|
|
|
|
// CreatePushMirrorOption represents need information to create a push mirror of a repository.
|
|
type CreatePushMirrorOption struct {
|
|
RemoteAddress string `json:"remote_address"`
|
|
RemoteUsername string `json:"remote_username"`
|
|
RemotePassword string `json:"remote_password"`
|
|
Interval string `json:"interval"`
|
|
SyncOnCommit bool `json:"sync_on_commit"`
|
|
UseSSH bool `json:"use_ssh"`
|
|
}
|
|
|
|
// PushMirror represents information of a push mirror
|
|
// swagger:model
|
|
type PushMirror struct {
|
|
RepoName string `json:"repo_name"`
|
|
RemoteName string `json:"remote_name"`
|
|
RemoteAddress string `json:"remote_address"`
|
|
// swagger:strfmt date-time
|
|
CreatedUnix time.Time `json:"created"`
|
|
// swagger:strfmt date-time
|
|
LastUpdateUnix *time.Time `json:"last_update"`
|
|
LastError string `json:"last_error"`
|
|
Interval string `json:"interval"`
|
|
SyncOnCommit bool `json:"sync_on_commit"`
|
|
PublicKey string `json:"public_key"`
|
|
}
|