feat: Add initial license manager backend application, configuration, and development installation documentation.
This commit is contained in:
1 parent
5f944dd88a
commit
91fe674dea
2 files changed
+20
-1
No files matched your search
+11
-1
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@@ -36,11 +37,20 @@ import (
|
|||||||
// @description Bearer token for authentication
|
// @description Bearer token for authentication
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// 定义命令行参数
|
||||||
|
var customPath string
|
||||||
|
flag.StringVar(&customPath, "config", "", "path to configuration file")
|
||||||
|
flag.StringVar(&customPath, "c", "", "path to configuration file (shorthand)")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
// 加载配置
|
// 加载配置
|
||||||
configPath := "config.yaml" // Docker 环境默认路径
|
configPath := customPath
|
||||||
|
if configPath == "" {
|
||||||
|
configPath = "config.yaml" // Docker 环境默认路径
|
||||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
||||||
configPath = "../configs/config.yaml" // 本地开发环境
|
configPath = "../configs/config.yaml" // 本地开发环境
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := config.Load(configPath); err != nil {
|
if err := config.Load(configPath); err != nil {
|
||||||
log.Fatalf("Failed to load config: %v", err)
|
log.Fatalf("Failed to load config: %v", err)
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
## 本地开发环境
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 使用默认配置
|
||||||
|
go run cmd/main.go
|
||||||
|
|
||||||
|
# 指定配置文件
|
||||||
|
go run . -config configs/config.dev.yaml
|
||||||
|
```
|
||||||
Reference in new issue
Block a user