mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-12 18:46:24 -07:00
Remove "Verbosity" config field and rename "DebugMode" to "Verbose" for enabling command line output on errors
This commit is contained in:
parent
138b41bf0a
commit
8e9543970a
9 changed files with 43 additions and 26 deletions
|
@ -164,7 +164,7 @@ type SystemCriticalConfig struct {
|
|||
DBpassword string
|
||||
DBprefix string
|
||||
|
||||
DebugMode bool
|
||||
Verbose bool `json:"DebugMode"`
|
||||
RandomSeed string
|
||||
Version *GochanVersion `json:"-"`
|
||||
TimeZone int `json:"-"`
|
||||
|
@ -185,7 +185,6 @@ type SiteConfig struct {
|
|||
|
||||
MaxRecentPosts int
|
||||
RecentPostsWithNoFile bool
|
||||
Verbosity int
|
||||
EnableAppeals bool
|
||||
MaxLogDays int
|
||||
|
||||
|
@ -374,8 +373,12 @@ func DeleteBoardConfig(dir string) {
|
|||
delete(boardConfigs, dir)
|
||||
}
|
||||
|
||||
func GetDebugMode() bool {
|
||||
return cfg.testing || cfg.SystemCriticalConfig.DebugMode
|
||||
func VerboseMode() bool {
|
||||
return cfg.testing || cfg.SystemCriticalConfig.Verbose
|
||||
}
|
||||
|
||||
func SetVerbose(verbose bool) {
|
||||
cfg.Verbose = verbose
|
||||
}
|
||||
|
||||
func GetVersion() *GochanVersion {
|
||||
|
|
|
@ -104,7 +104,6 @@ const (
|
|||
"GeoIPDBlocation": "/usr/share/GeoIP/GeoIP.dat",
|
||||
"MaxRecentPosts": 12,
|
||||
"RecentPostsWithNoFile": false,
|
||||
"Verbosity": 0,
|
||||
"EnableAppeals": true,
|
||||
"MaxLogDays": 14,
|
||||
"_comment": "Set RandomSeed to a (preferrably large) string of letters and numbers",
|
||||
|
|
|
@ -51,6 +51,12 @@ func (iv *InvalidValueError) Error() string {
|
|||
return str
|
||||
}
|
||||
|
||||
// GetUser returns the IDs of the user and group gochan should be acting as
|
||||
// when creating files. If they are 0, it is using the current user
|
||||
func GetUser() (int, int) {
|
||||
return uid, gid
|
||||
}
|
||||
|
||||
func TakeOwnership(fp string) (err error) {
|
||||
if runtime.GOOS == "windows" || fp == "" || cfg.Username == "" {
|
||||
// Chown returns an error in Windows so skip it, also skip if Username isn't set
|
||||
|
@ -78,7 +84,6 @@ func InitConfig(versionStr string) {
|
|||
cfg.ListenIP = "127.0.0.1"
|
||||
cfg.Port = 8080
|
||||
cfg.UseFastCGI = true
|
||||
cfg.DebugMode = true
|
||||
cfg.testing = true
|
||||
cfg.TemplateDir = "templates"
|
||||
cfg.DBtype = "sqlite3"
|
||||
|
@ -89,7 +94,7 @@ func InitConfig(versionStr string) {
|
|||
cfg.RandomSeed = "test"
|
||||
cfg.Version = ParseVersion(versionStr)
|
||||
cfg.SiteSlogan = "Gochan testing"
|
||||
cfg.Verbosity = 1
|
||||
cfg.Verbose = true
|
||||
cfg.Captcha.OnlyNeededForThreads = true
|
||||
cfg.Cooldowns = BoardCooldowns{0, 0, 0}
|
||||
cfg.BanColors = []string{
|
||||
|
@ -161,10 +166,6 @@ func InitConfig(versionStr string) {
|
|||
}
|
||||
|
||||
cfg.LogDir = gcutil.FindResource(cfg.LogDir, "log", "/var/log/gochan/")
|
||||
if err = gcutil.InitLogs(cfg.LogDir, cfg.DebugMode, uid, gid); err != nil {
|
||||
fmt.Println("Error opening logs:", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if cfg.Port == 0 {
|
||||
cfg.Port = 80
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue