config

package
v0.0.0-...-0169c2d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var App = TypeApp{
	Domain:       "localhost",
	HTTPPort:     ":80",
	SSLPort:      ":443",
	UseTLS:       true,
	TLSCrtPath:   "./domain.crt",
	TLSKeyPath:   "./domain.key",
	Title:        "作业布告栏",
	UserTimeZone: "Asia/Shanghai",
	AdminEmails: []string{
		"you@domain.com",
	},
}

App configs

View Source
var Database = TypeDatabase{
	Path: "./database.db",
}

Database configs

View Source
var Log = TypeLog{
	Filepath: "./logs",
}

Log configs

View Source
var Mail = TypeMail{
	MailAccount: "you@domain.com",
	Password:    "password",
	SMTPServer:  "smtp.somedomain.com",
	SMTPPort:    "465",
}

Mail configs

View Source
var Path = TypePath{
	StaticFoler:    "./app/static",
	UploadFolder:   "./upload",
	ViewsFolder:    "./app/views",
	NameListFolder: "./app/names",
}

Path configs

View Source
var Regex = TypeRegex{
	PatternQQ:    "^[0-9]{5,15}$",
	PatternStuID: "^2018[0-9]{8}$",
}

Regex configs

View Source
var WebConstance = map[string]string{
	"Title":                 "作业布告栏",
	"TaskList":              "作业列表",
	"SubmitHistory":         "提交记录",
	"AdminLogin":            "管理员登录",
	"UserLogin":             "登录",
	"UserLogout":            "登出",
	"Submit":                "提交",
	"PleaseLogin":           "未登录,请登录",
	"Available":             "可提交",
	"Unavailable":           "不可用",
	"SubmitPlaceHolder":     "选择文件(最大30MB)",
	"SubmitWarning":         "仅保存最后一次提交",
	"Email":                 "邮箱",
	"EmailConstr":           "qq.com",
	"EmailPlaceHolder":      "QQ号",
	"StuID":                 "学号",
	"StuIDPlaceHolder":      "201824100000",
	"LoginWarning":          "将发送邮件验证码,首次登录后学号将与邮箱绑定",
	"ConfirmKey":            "验证",
	"ConfirmKeyPlaceHolder": "邮件中的验证码",
	"SendConfirmKey":        "发送验证码",
	"MultiReg":              "重复注册, 请联系管理员",
	"Error":                 "错误",
	"UnknownError":          "未知错误",
	"MailError":             "邮件发送失败, 可能是提交过于频繁",
	"TimeValue":             "提交时间",
	"Subject":               "科目名称",
	"SubjectPlaceHolder":    "如:软件工程导论",
	"Subtitle":              "作业内容",
	"SubtitlePlaceHolder":   "如:第一章第1~12题",
	"FileFormat":            "作业格式",
	"FileFormatPlaceHolder": "如:pdf",
	"Date":                  "收取时间",
	"AdminSubmit":           "添加作业",
	"AdminWarning":          "添加后无法直接更改。如需更改请联系运维更改数据库",
	"SubmitTo":              "作业ID",
	"WantIDError":           "请求ID无效",
	"QueryIllegal":          "请求的ID不存在",
	"TaskNotEnd":            "请求的作业还未结束",
	"QueryFileSuccess":      "请求成功, 正在下载...",
	"QueryFileUnknownError": "请求失败",
	"NoAvailableFile":       "没有可用文件",
	"Class":                 "班",
	"ClassNo":               "所属班级",
	"ClassNoPlaceHolder":    "如:4",
	"NullClass":             "无班级约束",
}

WebConstance configs

Functions

func ExportDefault

func ExportDefault()

ExportDefault when need

func TryLoadConfig

func TryLoadConfig()

TryLoadConfig while init

Types

type TypeApp

type TypeApp struct {
	Domain       string   `json:"domain"`
	HTTPPort     string   `json:"httpPort"`
	SSLPort      string   `json:"sslPort"`
	UseTLS       bool     `json:"useTLS"`
	TLSCrtPath   string   `json:"crtFilepath"`
	TLSKeyPath   string   `json:"keyFilepath"`
	Title        string   `json:"appTitle"`
	UserTimeZone string   `json:"userTimeZone"`
	AdminEmails  []string `json:"adminEmails"`
}

TypeApp struct

type TypeDatabase

type TypeDatabase struct {
	Path string `json:"dbPath"`
}

TypeDatabase struct

type TypeLog

type TypeLog struct {
	Filepath string `json:"logPath"`
}

TypeLog struct

type TypeMail

type TypeMail struct {
	MailAccount string `json:"mailAccount"`
	Password    string `json:"mailPassword"`
	SMTPServer  string `json:"smtpServer"`
	SMTPPort    string `json:"smtpPort"`
}

TypeMail struct

type TypePath

type TypePath struct {
	StaticFoler    string `json:"staticFolder"`
	UploadFolder   string `json:"uploadFolder"`
	ViewsFolder    string `json:"viewsFolder"`
	NameListFolder string `json:"namelistFolder"`
}

TypePath struct

type TypeRegex

type TypeRegex struct {
	PatternQQ    string `json:"patternQQ"`
	PatternStuID string `json:"patternStudentID"`
}

TypeRegex struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL