mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-17 19:46:18 +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 commit e466f9d10e
)
This commit is contained in:
parent
e3a5f6c1ed
commit
e33e95931b
18
main.go
18
main.go
|
@ -50,11 +50,20 @@ func init() {
|
||||||
originalSubcommandHelpTemplate = cli.SubcommandHelpTemplate
|
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() {
|
func main() {
|
||||||
|
forgejoEnv()
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "Gitea"
|
app.Name = "Forgejo"
|
||||||
app.Usage = "A painless self-hosted Git service"
|
app.Usage = "Beyond coding. We forge."
|
||||||
app.Description = `By default, gitea will start serving using the webserver with no
|
app.Description = `By default, forgejo will start serving using the webserver with no
|
||||||
arguments - which can alternatively be run by running the subcommand web.`
|
arguments - which can alternatively be run by running the subcommand web.`
|
||||||
app.Version = Version + formatBuiltWith()
|
app.Version = Version + formatBuiltWith()
|
||||||
app.Commands = []cli.Command{
|
app.Commands = []cli.Command{
|
||||||
|
@ -177,6 +186,9 @@ func adjustHelpTemplate(originalTemplate string) string {
|
||||||
if _, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
|
if _, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
|
||||||
overridden = "(GITEA_CUSTOM)"
|
overridden = "(GITEA_CUSTOM)"
|
||||||
}
|
}
|
||||||
|
if _, ok := os.LookupEnv("FORGEJO_CUSTOM"); ok {
|
||||||
|
overridden = "(FORGEJO_CUSTOM)"
|
||||||
|
}
|
||||||
|
|
||||||
return fmt.Sprintf(`%s
|
return fmt.Sprintf(`%s
|
||||||
DEFAULT CONFIGURATION:
|
DEFAULT CONFIGURATION:
|
||||||
|
|
|
@ -167,6 +167,9 @@ func SetCustomPathAndConf(providedCustom, providedConf, providedWorkPath string)
|
||||||
if giteaCustom, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
|
if giteaCustom, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
|
||||||
CustomPath = giteaCustom
|
CustomPath = giteaCustom
|
||||||
}
|
}
|
||||||
|
if forgejoCustom, ok := os.LookupEnv("FORGEJO_CUSTOM"); ok {
|
||||||
|
CustomPath = forgejoCustom
|
||||||
|
}
|
||||||
if len(providedCustom) != 0 {
|
if len(providedCustom) != 0 {
|
||||||
CustomPath = providedCustom
|
CustomPath = providedCustom
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,10 +175,10 @@ func Config(ctx *context.Context) {
|
||||||
|
|
||||||
envVars := map[string]*envVar{}
|
envVars := map[string]*envVar{}
|
||||||
if len(os.Getenv("GITEA_WORK_DIR")) > 0 {
|
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 {
|
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
|
ctx.Data["EnvVars"] = envVars
|
||||||
|
|
Loading…
Reference in a new issue