lolly/main.go
xfy 92cd93d4c0 refactor: 代码改进与注释补充
- logging: 补充包文档说明
- pool: 修复 workers 计数器并发安全 (atomic 操作)
- stream: 完善注释与错误处理
- handler/static: 添加预压缩文件支持接口
- loadbalance: 补充算法注释
- vhost: 改进虚拟主机路由逻辑
- ssl: 优化证书加载注释
- main: 补充启动流程注释

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 16:57:59 +08:00

41 lines
1.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package main 提供 Lolly 服务器的入口程序。
//
// 该文件包含命令行参数解析和应用程序启动逻辑:
// - 配置文件路径指定(-c/--config
// - 默认配置生成(--generate-config
// - 版本信息显示(-v
//
// 使用示例:
//
// lolly -c /etc/lolly.yaml # 使用指定配置启动
// lolly --generate-config -o config.yaml # 生成默认配置
// lolly -v # 显示版本信息
//
// 作者xfy
package main
import (
"flag"
"os"
"rua.plus/lolly/internal/app"
)
func main() {
cfgPath := flag.String("c", "lolly.yaml", "配置文件路径")
cfgPathLong := flag.String("config", "", "配置文件路径(长参数)")
genConfig := flag.Bool("generate-config", false, "生成默认配置")
outputPath := flag.String("o", "", "输出文件路径(配合 --generate-config")
showVersion := flag.Bool("v", false, "显示版本")
flag.Parse()
// 合并短参数和长参数
configPath := *cfgPath
if *cfgPathLong != "" {
configPath = *cfgPathLong
}
os.Exit(app.Run(configPath, *genConfig, *outputPath, *showVersion))
}