config

package
v1.1.1-0...-647775e Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 10 Imported by: 5

Documentation

Overview

Package config 用于处理配置

Index

Constants

This section is empty.

Variables

View Source
var Root string

Root 项目的根目录

Functions

This section is empty.

Types

type Config

type Config struct {
	// 应用的名称
	Name string `toml:"name"`

	// 应用的域名
	URL string `toml:"url"`

	// 应用的监听地址,为空就是 0.0.0.0
	Host string `toml:"host"`

	// 应用端口号
	Port uint `toml:"port"`

	// 是否开启 debug,
	// 如果 ture ,对应的 gin 就是 debug 模式,
	// 如果 false , 对应的 gin 就是 release 模式
	Debug bool

	// 日志相关的配置
	Log Log `toml:"log"`

	// markdown 的默认目录
	MarkdownDir string `toml:"markdown_dir"`

	// icp 备案信息
	ICP string `toml:"icp"`

	// 百度统计 的 key
	Tongji string

	// Github 钩子中配置的 Secret
	Secret string
}

Config 配置文件类型

var (

	// Cfg 配置文件
	Cfg Config
)

func (*Config) Addr

func (cfg *Config) Addr() string

Addr 获取服务器需要的监听地址

type Log

type Log struct {
	// 日志模式,对应这的是 LogClose ,LogFile, LogStdout
	Mode string `toml:"mode"`

	// 日志文件的保存目录
	Dir string `toml:"dir"`

	// 日志文件的格式
	Format string

	// 是否开启访问日志,一般开启,有时可以关闭,比如部署在 Nginx 后面,
	// Nginx 已经开启了,可以考虑把这个日志关闭,记录两份有点多了
	Access bool
}

Log 是日志相关的配置

Jump to

Keyboard shortcuts

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