mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 08:38:29 +00:00
[BRANDING] alias {FORGEJO,GITEA}_{CUSTOM,WORK_DIR}
FORGEJO_* environment variables are set to the corresponding GITEA_* variable when the cli starts. This approach is intended to minimize the conflicts on rebase. All occurences of GITEA_* are left untouched in the codebase and they are only changed to FORGEJO_* if exposed to the user. (cherry picked from commite466f9d10e
) (cherry picked from commite33e95931b
) (cherry picked from commit2cfc6519b7
) (cherry picked from commitaf8864373a
) (cherry picked from commita0550ff339
) (cherry picked from commit24dc0a5191
) (cherry picked from commite255eea2b4
) (cherry picked from commit0c4f5afa7a
) (cherry picked from commit42fce708d0
) (cherry picked from commite7278c3c22
) (cherry picked from commit0fb9ed7e0e
) (cherry picked from commita98308aa4d
) (cherry picked from commitb8695fcbe0
) (cherry picked from commit4aee8719f5
)
This commit is contained in:
parent
38ef6802fc
commit
1c503c1ba7
18
main.go
18
main.go
|
@ -50,11 +50,20 @@ func init() {
|
|||
originalSubcommandHelpTemplate = cli.SubcommandHelpTemplate
|
||||
}
|
||||
|
||||
func forgejoEnv() {
|
||||
for _, k := range []string{"CUSTOM", "WORK_DIR"} {
|
||||
if v, ok := os.LookupEnv("FORGEJO_" + k); ok {
|
||||
os.Setenv("GITEA_"+k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
forgejoEnv()
|
||||
app := cli.NewApp()
|
||||
app.Name = "Gitea"
|
||||
app.Usage = "A painless self-hosted Git service"
|
||||
app.Description = `By default, gitea will start serving using the webserver with no
|
||||
app.Name = "Forgejo"
|
||||
app.Usage = "Beyond coding. We forge."
|
||||
app.Description = `By default, forgejo will start serving using the webserver with no
|
||||
arguments - which can alternatively be run by running the subcommand web.`
|
||||
app.Version = Version + formatBuiltWith()
|
||||
app.Commands = []cli.Command{
|
||||
|
@ -180,6 +189,9 @@ func adjustHelpTemplate(originalTemplate string) string {
|
|||
if _, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
|
||||
overridden = "(GITEA_CUSTOM)"
|
||||
}
|
||||
if _, ok := os.LookupEnv("FORGEJO_CUSTOM"); ok {
|
||||
overridden = "(FORGEJO_CUSTOM)"
|
||||
}
|
||||
|
||||
return fmt.Sprintf(`%s
|
||||
DEFAULT CONFIGURATION:
|
||||
|
|
|
@ -147,6 +147,9 @@ func SetCustomPathAndConf(providedCustom, providedConf, providedWorkPath string)
|
|||
if giteaCustom, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
|
||||
CustomPath = giteaCustom
|
||||
}
|
||||
if forgejoCustom, ok := os.LookupEnv("FORGEJO_CUSTOM"); ok {
|
||||
CustomPath = forgejoCustom
|
||||
}
|
||||
if len(providedCustom) != 0 {
|
||||
CustomPath = providedCustom
|
||||
}
|
||||
|
|
|
@ -174,10 +174,10 @@ func Config(ctx *context.Context) {
|
|||
|
||||
envVars := map[string]*envVar{}
|
||||
if len(os.Getenv("GITEA_WORK_DIR")) > 0 {
|
||||
envVars["GITEA_WORK_DIR"] = &envVar{"GITEA_WORK_DIR", os.Getenv("GITEA_WORK_DIR")}
|
||||
envVars["FORGEJO_WORK_DIR"] = &envVar{"GITEA_WORK_DIR", os.Getenv("GITEA_WORK_DIR")}
|
||||
}
|
||||
if len(os.Getenv("GITEA_CUSTOM")) > 0 {
|
||||
envVars["GITEA_CUSTOM"] = &envVar{"GITEA_CUSTOM", os.Getenv("GITEA_CUSTOM")}
|
||||
envVars["FORGEJO_CUSTOM"] = &envVar{"GITEA_CUSTOM", os.Getenv("GITEA_CUSTOM")}
|
||||
}
|
||||
|
||||
ctx.Data["EnvVars"] = envVars
|
||||
|
|
Loading…
Reference in a new issue