Skip to content

Commit 43f4fff

Browse files
committed
fix
1 parent 6daf21c commit 43f4fff

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

cmd/embedded.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"github.com/urfave/cli"
2323
)
2424

25-
// Cmdembedded represents the available extract sub-command.
25+
// CmdEmbedded represents the available extract sub-command.
2626
var (
27-
Cmdembedded = cli.Command{
27+
CmdEmbedded = cli.Command{
2828
Name: "embedded",
2929
Usage: "Extract embedded resources",
3030
Description: "A command for extracting embedded resources, like templates and images",

main.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,29 @@ func main() {
8787
app.Description = `By default, Gitea will start serving using the web-server with no argument, which can alternatively be run by running the subcommand "web".`
8888
app.Version = Version + formatBuiltWith()
8989
app.EnableBashCompletion = true
90-
app.Commands = []cli.Command{
90+
91+
subCmdWithIni := []cli.Command{
9192
cmd.CmdWeb,
9293
cmd.CmdServ,
9394
cmd.CmdHook,
9495
cmd.CmdDump,
95-
cmd.CmdCert,
9696
cmd.CmdAdmin,
97-
cmd.CmdGenerate,
9897
cmd.CmdMigrate,
9998
cmd.CmdKeys,
10099
cmd.CmdConvert,
101100
cmd.CmdDoctor,
102101
cmd.CmdManager,
103-
cmd.Cmdembedded,
102+
cmd.CmdEmbedded,
104103
cmd.CmdMigrateStorage,
105-
cmd.CmdDocs,
106104
cmd.CmdDumpRepository,
107105
cmd.CmdRestoreRepository,
108106
cmd.CmdActions,
107+
cmdHelp, // TODO: the "help" sub-command was used to show the more information for "work path" and "custom config", in the future, it should avoid doing so
108+
}
109+
subCmdWithStandalone := []cli.Command{
110+
cmd.CmdCert,
111+
cmd.CmdGenerate,
112+
cmd.CmdDocs,
109113
}
110114

111115
// shared configuration flags, they are for global and for each sub-command at the same time
@@ -134,10 +138,11 @@ func main() {
134138
app.Action = prepareWorkPathAndCustomConf(cmd.CmdWeb.Action)
135139
app.HideHelp = true // use our own help action to show helps (with more information like default config)
136140
app.Before = cmd.PrepareConsoleLoggerLevel(log.INFO)
137-
app.Commands = append(app.Commands, cmdHelp)
138-
for i := range app.Commands {
139-
prepareSubcommands(&app.Commands[i], globalFlags)
141+
for i := range subCmdWithIni {
142+
prepareSubcommands(&subCmdWithIni[i], globalFlags)
140143
}
144+
app.Commands = append(app.Commands, subCmdWithIni...)
145+
app.Commands = append(app.Commands, subCmdWithStandalone...)
141146

142147
err := app.Run(os.Args)
143148
if err != nil {

modules/setting/oauth2.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ func loadOAuth2From(rootCfg ConfigProvider) {
116116
return
117117
}
118118

119+
if !OAuth2.Enable {
120+
return
121+
}
122+
119123
OAuth2.JWTSecretBase64 = loadSecret(rootCfg.Section("oauth2"), "JWT_SECRET_URI", "JWT_SECRET")
120124

121125
if !filepath.IsAbs(OAuth2.JWTSigningPrivateKeyFile) {

0 commit comments

Comments
 (0)