diff --git a/.gitignore b/.gitignore index f775b6b..0e8f23f 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ go.work # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff +.idea .idea/**/workspace.xml .idea/**/tasks.xml .idea/**/usage.statistics.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/config/conf_logger.go b/config/conf_logger.go new file mode 100644 index 0000000..f2580e5 --- /dev/null +++ b/config/conf_logger.go @@ -0,0 +1,10 @@ +package config + +// Logger 配置 +type Logger struct { + Level string `yaml:"level"` // 日志级别 + Prefix string `yaml:"prefix"` // 日志前缀 + Director string `yaml:"director"` // 日志文件存放目录 + ShowLine string `yaml:"showLine"` // 是否显示文件行号 + LogInConsole string `yaml:"logInConsole"` // 是否在控制台打印日志 +} diff --git a/config/conf_mysql.go b/config/conf_mysql.go new file mode 100644 index 0000000..1b340b0 --- /dev/null +++ b/config/conf_mysql.go @@ -0,0 +1,11 @@ +package config + +// MySQL 配置 +type MySQL struct { + Host string `yaml:"host"` //主机地址 + Port string `yaml:"port"` //端口号 + DB string `yaml:"db"` //数据库名 + User string `yaml:"user"` //用户名 + Password string `yaml:"password"` //密码 + LogLevel string `yaml:"log-level"` // 日志级别 debug: 输出全部SQL语句; release: 只输出错误信息 +} diff --git a/config/conf_system.go b/config/conf_system.go new file mode 100644 index 0000000..6941a84 --- /dev/null +++ b/config/conf_system.go @@ -0,0 +1,8 @@ +package config + +// System 系统配置 +type System struct { + Host string `yaml:"host"` //主机地址 + Port string `yaml:"port"` //端口号 + Env string `yaml:"env"` //环境 +} diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..ccf4fda --- /dev/null +++ b/config/config.go @@ -0,0 +1,7 @@ +package config + +type Config struct { + MySQL MySQL `yaml:"mysql"` + Logger Logger `yaml:"logger"` + System System `yaml:"system"` +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b653839 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module schisandra-cloud-album + +go 1.22.5 diff --git a/main.go b/main.go new file mode 100644 index 0000000..06ab7d0 --- /dev/null +++ b/main.go @@ -0,0 +1 @@ +package main diff --git a/settings.yaml b/settings.yaml new file mode 100644 index 0000000..059e71f --- /dev/null +++ b/settings.yaml @@ -0,0 +1,20 @@ +# 系统配置 +system: + host: "0.0.0.0" # 主机地址 + port: 8080 # 端口 + env: env # 环境 +# MySQL配置 +mysql: + host: "1.95.0.111" # 主机地址 + port: 3306 # 端口 + db: schisandra-cloud-album # 数据库名称 + user: root # 用户名 + password: LDQ20020618xxx # 密码 + log-level: dev # 日志级别 +# 日志配置 +logger: + level: info # 日志级别 + prefix: "[schisandra]" # 日志前缀 + director: log # 日志文件存放目录 + show-line: true # 是否显示文件行号 + log-in-console: true # 是否在控制台打印日志 \ No newline at end of file