Skip to content

Commit 71d2c21

Browse files
Loïc Dacharyearl-warren
authored andcommitted
[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 e466f9d10e145a3ed750f0c86cfcafad5f141ea8) (cherry picked from commit e33e95931b0d91c41433db68ddb19a8724b8ed80) (cherry picked from commit 5f528f0a25d0418b9c4ebdc4effa8d2b869be0d8) (cherry picked from commit 65146bfbcd1102a8e182ac6967804659fea9651f) (cherry picked from commit 393eede84a856ae4545c2f5695eba5cbf4d57fbb) (cherry picked from commit df68ae9d1f00b4c465cd717f8a91a8a94aae5703) (cherry picked from commit 2f05b0cc1fea60cb685fc10f083ce0053641bbe5)
1 parent 9da7c9b commit 71d2c21

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

main.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,20 @@ func init() {
5050
originalSubcommandHelpTemplate = cli.SubcommandHelpTemplate
5151
}
5252

53+
func forgejoEnv() {
54+
for _, k := range []string{"CUSTOM", "WORK_DIR"} {
55+
if v, ok := os.LookupEnv("FORGEJO_" + k); ok {
56+
os.Setenv("GITEA_"+k, v)
57+
}
58+
}
59+
}
60+
5361
func main() {
62+
forgejoEnv()
5463
app := cli.NewApp()
55-
app.Name = "Gitea"
56-
app.Usage = "A painless self-hosted Git service"
57-
app.Description = `By default, gitea will start serving using the webserver with no
64+
app.Name = "Forgejo"
65+
app.Usage = "Beyond coding. We forge."
66+
app.Description = `By default, forgejo will start serving using the webserver with no
5867
arguments - which can alternatively be run by running the subcommand web.`
5968
app.Version = Version + formatBuiltWith()
6069
app.Commands = []cli.Command{
@@ -178,6 +187,9 @@ func adjustHelpTemplate(originalTemplate string) string {
178187
if _, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
179188
overridden = "(GITEA_CUSTOM)"
180189
}
190+
if _, ok := os.LookupEnv("FORGEJO_CUSTOM"); ok {
191+
overridden = "(FORGEJO_CUSTOM)"
192+
}
181193

182194
return fmt.Sprintf(`%s
183195
DEFAULT CONFIGURATION:

modules/setting/setting.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ func SetCustomPathAndConf(providedCustom, providedConf, providedWorkPath string)
167167
if giteaCustom, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
168168
CustomPath = giteaCustom
169169
}
170+
if forgejoCustom, ok := os.LookupEnv("FORGEJO_CUSTOM"); ok {
171+
CustomPath = forgejoCustom
172+
}
170173
if len(providedCustom) != 0 {
171174
CustomPath = providedCustom
172175
}

routers/web/admin/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ func Config(ctx *context.Context) {
175175

176176
envVars := map[string]*envVar{}
177177
if len(os.Getenv("GITEA_WORK_DIR")) > 0 {
178-
envVars["GITEA_WORK_DIR"] = &envVar{"GITEA_WORK_DIR", os.Getenv("GITEA_WORK_DIR")}
178+
envVars["FORGEJO_WORK_DIR"] = &envVar{"GITEA_WORK_DIR", os.Getenv("GITEA_WORK_DIR")}
179179
}
180180
if len(os.Getenv("GITEA_CUSTOM")) > 0 {
181-
envVars["GITEA_CUSTOM"] = &envVar{"GITEA_CUSTOM", os.Getenv("GITEA_CUSTOM")}
181+
envVars["FORGEJO_CUSTOM"] = &envVar{"GITEA_CUSTOM", os.Getenv("GITEA_CUSTOM")}
182182
}
183183

184184
ctx.Data["EnvVars"] = envVars

0 commit comments

Comments
 (0)