Documentation ¶
Overview ¶
Package cmd provides subcommands to the gitea binary - such as "web" or "admin".
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// CmdActions represents the available actions sub-commands.
CmdActions = &cli.Command{
Name: "actions",
Usage: "Manage Gitea Actions",
Subcommands: []*cli.Command{
subcmdActionsGenRunnerToken,
},
}
)
var (
// CmdAdmin represents the available admin sub-command.
CmdAdmin = &cli.Command{
Name: "admin",
Usage: "Perform common administrative operations",
Subcommands: []*cli.Command{
subcmdUser,
subcmdRepoSyncReleases,
subcmdRegenerate,
subcmdAuth,
subcmdSendMail,
},
}
)
var CmdCert = &cli.Command{ Name: "cert", Usage: "Generate self-signed certificate", Description: `Generate a self-signed X.509 certificate for a TLS server. Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`, Action: runCert, Flags: []cli.Flag{ &cli.StringFlag{ Name: "host", Value: "", Usage: "Comma-separated hostnames and IPs to generate a certificate for", }, &cli.StringFlag{ Name: "ecdsa-curve", Value: "", Usage: "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", }, &cli.IntFlag{ Name: "rsa-bits", Value: 3072, Usage: "Size of RSA key to generate. Ignored if --ecdsa-curve is set", }, &cli.StringFlag{ Name: "start-date", Value: "", Usage: "Creation date formatted as Jan 1 15:04:05 2011", }, &cli.DurationFlag{ Name: "duration", Value: 365 * 24 * time.Hour, Usage: "Duration that certificate is valid for", }, &cli.BoolFlag{ Name: "ca", Usage: "whether this cert should be its own Certificate Authority", }, }, }
CmdCert represents the available cert sub-command.
var CmdDocs = &cli.Command{ Name: "docs", Usage: "Output CLI documentation", Description: "A command to output Gitea's CLI documentation, optionally to a file.", Action: runDocs, Flags: []cli.Flag{ &cli.BoolFlag{ Name: "man", Usage: "Output man pages instead", }, &cli.StringFlag{ Name: "output", Aliases: []string{"o"}, Usage: "Path to output to instead of stdout (will overwrite if exists)", }, }, }
CmdDocs represents the available docs sub-command.
var CmdDoctor = &cli.Command{
Name: "doctor",
Usage: "Diagnose and optionally fix problems, convert or re-create database tables",
Description: "A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
Subcommands: []*cli.Command{
cmdDoctorCheck,
cmdRecreateTable,
cmdDoctorConvert,
},
}
CmdDoctor represents the available doctor sub-command.
var CmdDump = &cli.Command{ Name: "dump", Usage: "Dump Gitea files and database", Description: `Dump compresses all related files and database into zip file. It can be used for backup and capture Gitea server image to send to maintainer`, Action: runDump, Flags: []cli.Flag{ &cli.StringFlag{ Name: "file", Aliases: []string{"f"}, Usage: `Name of the dump file which will be created, default to "gitea-dump-{time}.zip". Supply '-' for stdout. See type for available types.`, }, &cli.BoolFlag{ Name: "verbose", Aliases: []string{"V"}, Usage: "Show process details", }, &cli.BoolFlag{ Name: "quiet", Aliases: []string{"q"}, Usage: "Only display warnings and errors", }, &cli.StringFlag{ Name: "tempdir", Aliases: []string{"t"}, Value: os.TempDir(), Usage: "Temporary dir path", }, &cli.StringFlag{ Name: "database", Aliases: []string{"d"}, Usage: "Specify the database SQL syntax: sqlite3, mysql, mssql, postgres", }, &cli.BoolFlag{ Name: "skip-repository", Aliases: []string{"R"}, Usage: "Skip the repository dumping", }, &cli.BoolFlag{ Name: "skip-log", Aliases: []string{"L"}, Usage: "Skip the log dumping", }, &cli.BoolFlag{ Name: "skip-custom-dir", Usage: "Skip custom directory", }, &cli.BoolFlag{ Name: "skip-lfs-data", Usage: "Skip LFS data", }, &cli.BoolFlag{ Name: "skip-attachment-data", Usage: "Skip attachment data", }, &cli.BoolFlag{ Name: "skip-package-data", Usage: "Skip package data", }, &cli.BoolFlag{ Name: "skip-index", Usage: "Skip bleve index data", }, &cli.BoolFlag{ Name: "skip-db", Usage: "Skip database", }, &cli.StringFlag{ Name: "type", Usage: fmt.Sprintf(`Dump output format, default to "zip", supported types: %s`, strings.Join(dump.SupportedOutputTypes, ", ")), }, }, }
CmdDump represents the available dump sub-command.
var CmdDumpRepository = &cli.Command{ Name: "dump-repo", Usage: "Dump the repository from git/github/gitea/gitlab", Description: "This is a command for dumping the repository data.", Action: runDumpRepository, Flags: []cli.Flag{ &cli.StringFlag{ Name: "git_service", Value: "", Usage: "Git service, git, github, gitea, gitlab. If clone_addr could be recognized, this could be ignored.", }, &cli.StringFlag{ Name: "repo_dir", Aliases: []string{"r"}, Value: "./data", Usage: "Repository dir path to store the data", }, &cli.StringFlag{ Name: "clone_addr", Value: "", Usage: "The URL will be clone, currently could be a git/github/gitea/gitlab http/https URL", }, &cli.StringFlag{ Name: "auth_username", Value: "", Usage: "The username to visit the clone_addr", }, &cli.StringFlag{ Name: "auth_password", Value: "", Usage: "The password to visit the clone_addr", }, &cli.StringFlag{ Name: "auth_token", Value: "", Usage: "The personal token to visit the clone_addr", }, &cli.StringFlag{ Name: "owner_name", Value: "", Usage: "The data will be stored on a directory with owner name if not empty", }, &cli.StringFlag{ Name: "repo_name", Value: "", Usage: "The data will be stored on a directory with repository name if not empty", }, &cli.StringFlag{ Name: "units", Value: "", Usage: `Which items will be migrated, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.`, }, }, }
CmdDumpRepository represents the available dump repository sub-command.
var (
CmdEmbedded = &cli.Command{
Name: "embedded",
Usage: "Extract embedded resources",
Description: "A command for extracting embedded resources, like templates and images",
Subcommands: []*cli.Command{
subcmdList,
subcmdView,
subcmdExtract,
},
}
)
CmdEmbedded represents the available extract sub-command.
var (
// CmdGenerate represents the available generate sub-command.
CmdGenerate = &cli.Command{
Name: "generate",
Usage: "Generate Gitea's secrets/keys/tokens",
Subcommands: []*cli.Command{
subcmdSecret,
},
}
)
var ( // CmdHook represents the available hooks sub-command. CmdHook = &cli.Command{ Name: "hook", Usage: "(internal) Should only be called by Git", Description: "Delegate commands to corresponding Git hooks", Before: PrepareConsoleLoggerLevel(log.FATAL), Subcommands: []*cli.Command{ subcmdHookPreReceive, subcmdHookUpdate, subcmdHookPostReceive, subcmdHookProcReceive, }, } )
var CmdKeys = &cli.Command{ Name: "keys", Usage: "(internal) Should only be called by SSH server", Description: "Queries the Gitea database to get the authorized command for a given ssh key fingerprint", Before: PrepareConsoleLoggerLevel(log.FATAL), Action: runKeys, Flags: []cli.Flag{ &cli.StringFlag{ Name: "expected", Aliases: []string{"e"}, Value: "git", Usage: "Expected user for whom provide key commands", }, &cli.StringFlag{ Name: "username", Aliases: []string{"u"}, Value: "", Usage: "Username trying to log in by SSH", }, &cli.StringFlag{ Name: "type", Aliases: []string{"t"}, Value: "", Usage: "Type of the SSH key provided to the SSH Server (requires content to be provided too)", }, &cli.StringFlag{ Name: "content", Aliases: []string{"k"}, Value: "", Usage: "Base64 encoded content of the SSH key provided to the SSH Server (requires type to be provided too)", }, }, }
CmdKeys represents the available keys sub-command
var (
// CmdManager represents the manager command
CmdManager = &cli.Command{
Name: "manager",
Usage: "Manage the running gitea process",
Description: "This is a command for managing the running gitea process",
Subcommands: []*cli.Command{
subcmdShutdown,
subcmdRestart,
subcmdReloadTemplates,
subcmdFlushQueues,
subcmdLogging,
subCmdProcesses,
},
}
)
var CmdMigrate = &cli.Command{
Name: "migrate",
Usage: "Migrate the database",
Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.",
Action: runMigrate,
}
CmdMigrate represents the available migrate sub-command.
var CmdMigrateStorage = &cli.Command{ Name: "migrate-storage", Usage: "Migrate the storage", Description: "Copies stored files from storage configured in app.ini to parameter-configured storage", Action: runMigrateStorage, Flags: []cli.Flag{ &cli.StringFlag{ Name: "type", Aliases: []string{"t"}, Value: "", Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log', 'actions-artifacts", }, &cli.StringFlag{ Name: "storage", Aliases: []string{"s"}, Value: "", Usage: "New storage type: local (default), minio or azureblob", }, &cli.StringFlag{ Name: "path", Aliases: []string{"p"}, Value: "", Usage: "New storage placement if store is local (leave blank for default)", }, &cli.StringFlag{ Name: "minio-endpoint", Value: "", Usage: "Minio storage endpoint", }, &cli.StringFlag{ Name: "minio-access-key-id", Value: "", Usage: "Minio storage accessKeyID", }, &cli.StringFlag{ Name: "minio-secret-access-key", Value: "", Usage: "Minio storage secretAccessKey", }, &cli.StringFlag{ Name: "minio-bucket", Value: "", Usage: "Minio storage bucket", }, &cli.StringFlag{ Name: "minio-location", Value: "", Usage: "Minio storage location to create bucket", }, &cli.StringFlag{ Name: "minio-base-path", Value: "", Usage: "Minio storage base path on the bucket", }, &cli.BoolFlag{ Name: "minio-use-ssl", Usage: "Enable SSL for minio", }, &cli.BoolFlag{ Name: "minio-insecure-skip-verify", Usage: "Skip SSL verification", }, &cli.StringFlag{ Name: "minio-checksum-algorithm", Value: "", Usage: "Minio checksum algorithm (default/md5)", }, &cli.StringFlag{ Name: "minio-bucket-lookup-type", Value: "", Usage: "Minio bucket lookup type", }, &cli.StringFlag{ Name: "azureblob-endpoint", Value: "", Usage: "Azure Blob storage endpoint", }, &cli.StringFlag{ Name: "azureblob-account-name", Value: "", Usage: "Azure Blob storage account name", }, &cli.StringFlag{ Name: "azureblob-account-key", Value: "", Usage: "Azure Blob storage account key", }, &cli.StringFlag{ Name: "azureblob-container", Value: "", Usage: "Azure Blob storage container", }, &cli.StringFlag{ Name: "azureblob-base-path", Value: "", Usage: "Azure Blob storage base path", }, }, }
CmdMigrateStorage represents the available migrate storage sub-command.
var CmdRestoreRepository = &cli.Command{ Name: "restore-repo", Usage: "Restore the repository from disk", Description: "This is a command for restoring the repository data.", Action: runRestoreRepository, Flags: []cli.Flag{ &cli.StringFlag{ Name: "repo_dir", Aliases: []string{"r"}, Value: "./data", Usage: "Repository dir path to restore from", }, &cli.StringFlag{ Name: "owner_name", Value: "", Usage: "Restore destination owner name", }, &cli.StringFlag{ Name: "repo_name", Value: "", Usage: "Restore destination repository name", }, &cli.StringFlag{ Name: "units", Value: "", Usage: `Which items will be restored, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.`, }, &cli.BoolFlag{ Name: "validation", Usage: "Sanity check the content of the files before trying to load them", }, }, }
CmdRestoreRepository represents the available restore a repository sub-command.
var CmdServ = &cli.Command{ Name: "serv", Usage: "(internal) Should only be called by SSH shell", Description: "Serv provides access auth for repositories", Before: PrepareConsoleLoggerLevel(log.FATAL), Action: runServ, Flags: []cli.Flag{ &cli.BoolFlag{ Name: "enable-pprof", }, &cli.BoolFlag{ Name: "debug", }, }, }
CmdServ represents the available serv sub-command.
var CmdWeb = &cli.Command{ Name: "web", Usage: "Start Gitea web server", Description: `Gitea web server is the only thing you need to run, and it takes care of all the other things for you`, Before: PrepareConsoleLoggerLevel(log.INFO), Action: runWeb, Flags: []cli.Flag{ &cli.StringFlag{ Name: "port", Aliases: []string{"p"}, Value: "3000", Usage: "Temporary port number to prevent conflict", }, &cli.StringFlag{ Name: "install-port", Value: "3000", Usage: "Temporary port number to run the install page on to prevent conflict", }, &cli.StringFlag{ Name: "pid", Aliases: []string{"P"}, Value: PIDFile, Usage: "Custom pid file path", }, &cli.BoolFlag{ Name: "quiet", Aliases: []string{"q"}, Usage: "Only display Fatal logging errors until logging is set-up", }, &cli.BoolFlag{ Name: "verbose", Usage: "Set initial logging to TRACE level until logging is properly set-up", }, }, }
CmdWeb represents the available web sub-command.
var PIDFile = "/run/gitea.pid"
PIDFile could be set from build tag
Functions ¶
func NewMainApp ¶
func NewMainApp(appVer AppVersion) *cli.App
func NoHTTPRedirector ¶
func NoHTTPRedirector()
NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
func NoInstallListener ¶
func NoInstallListener()
NoInstallListener tells our cleanup routine that we will not be using a possibly provided listener for our install HTTP/HTTPS service
func NoMainListener ¶
func NoMainListener()
NoMainListener tells our cleanup routine that we will not be using a possibly provided listener for our main HTTP/HTTPS service
func PrepareConsoleLoggerLevel ¶
PrepareConsoleLoggerLevel by default, use INFO level for console logger, but some sub-commands (for git/ssh protocol) shouldn't output any log to stdout. Any log appears in git stdout pipe will break the git protocol, eg: client can't push and hangs forever.
func RunMainApp ¶
Types ¶
type AppVersion ¶
Source Files ¶
- actions.go
- admin.go
- admin_auth.go
- admin_auth_ldap.go
- admin_auth_oauth.go
- admin_auth_stmp.go
- admin_regenerate.go
- admin_user.go
- admin_user_change_password.go
- admin_user_create.go
- admin_user_delete.go
- admin_user_generate_access_token.go
- admin_user_list.go
- admin_user_must_change_password.go
- cert.go
- cmd.go
- docs.go
- doctor.go
- doctor_convert.go
- dump.go
- dump_repo.go
- embedded.go
- generate.go
- hook.go
- keys.go
- mailer.go
- main.go
- manager.go
- manager_logging.go
- migrate.go
- migrate_storage.go
- restore_repo.go
- serv.go
- web.go
- web_acme.go
- web_graceful.go
- web_https.go