Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new command doctor to check if some wrong configurations on gitea instance #9095

Merged
merged 5 commits into from
Jan 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add doctor
  • Loading branch information
lunny committed Jan 11, 2020
commit 23a288fbe92ad0165d24801e0d4797f826f4ef4a
31 changes: 31 additions & 0 deletions cmd/doctor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package cmd

import (
"github.com/urfave/cli"

"code.gitea.io/gitea/modules/setting"
)

// CmdDoctor represents the available doctor sub-command.
var CmdDoctor = cli.Command{
Name: "doctor",
Usage: "Diagnose the problems",
Description: "A command to diagnose the problems of current gitea instance according the given configuration.",
Action: runDoctor,
}

func runDoctor(ctx *cli.Context) error {
if err := initDB(); err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be give the users some hints about this kind of catastrophic failure (e.g. "make sure to use a --config directive", "check if the --config file points to the right file", "make sure you have the right permissions", etc.) even if the problem might not be related to any of the listed hints.

}

runDoctorLocationMoved(ctx)
}

func runDoctorLocationMoved(ctx *cliContext) {
setting.RepoRootPath
}