提交 bc46e333 编写于 作者: T Tyler Compton

Add an "assets_dir" option for frpc

This option allows users to specify where they want assets to be loaded
from, like the "assets_dir" option that already exists for frps. This
allows library users to use the admin panel without having to bundle
assets with statik.
上级 00bd0a8a
......@@ -96,7 +96,7 @@ func (svr *Service) Run() error {
if g.GlbClientCfg.AdminPort != 0 {
// Init admin server assets
err := assets.Load("")
err := assets.Load(g.GlbClientCfg.AssetsDir)
if err != nil {
return fmt.Errorf("Load assets error: %v", err)
}
......
......@@ -29,6 +29,8 @@ admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = admin
# Admin assets directory. By default, these assets are bundled with frpc.
# assets_dir = ./static
# connections will be established in advance, default value is zero
pool_count = 5
......
......@@ -38,6 +38,7 @@ type ClientCommonConf struct {
AdminPort int `json:"admin_port"`
AdminUser string `json:"admin_user"`
AdminPwd string `json:"admin_pwd"`
AssetsDir string `json:"assets_dir"`
PoolCount int `json:"pool_count"`
TcpMux bool `json:"tcp_mux"`
User string `json:"user"`
......@@ -65,6 +66,7 @@ func GetDefaultClientConf() *ClientCommonConf {
AdminPort: 0,
AdminUser: "",
AdminPwd: "",
AssetsDir: "",
PoolCount: 1,
TcpMux: true,
User: "",
......@@ -160,6 +162,10 @@ func UnmarshalClientConfFromIni(defaultCfg *ClientCommonConf, content string) (c
cfg.AdminPwd = tmpStr
}
if tmpStr, ok = conf.Get("common", "assets_dir"); ok {
cfg.AssetsDir = tmpStr
}
if tmpStr, ok = conf.Get("common", "pool_count"); ok {
if v, err = strconv.ParseInt(tmpStr, 10, 64); err == nil {
cfg.PoolCount = int(v)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册