Commit c32db87d authored by ibuler's avatar ibuler

Merge branch 'dev' of github.com:jumpserver/koko into dev

parents ebd7b1c2 4b037ec5
......@@ -42,7 +42,7 @@ make linux
tar xzf koko-[branch name]-[commit]-linux-amd64.tar.gz
```
3.创建配置文件config.yml,配置参数请参考[coco](https://github.com/jumpserver/coco/blob/master/config_example.yml)
3.创建配置文件config.yml,配置参数请参考[cmd](https://github.com/jumpserver/koko/tree/master/cmd)目录下的config_example.yml文件
```shell
touch config.yml
```
......
......@@ -48,3 +48,6 @@ BOOTSTRAP_TOKEN: <PleasgeChangeSameWithJumpserver>
# 是否复用和用户后端资产已建立的连接(用户不会复用其他用户的连接)
# REUSE_CONNECTION: true
# 资产加载策略, 可根据资产规模自行调整. 默认异步加载资产, 异步搜索分页; 如果为all, 则资产全部加载, 本地搜索分页.
# ASSET_LOAD_POLICY:
\ No newline at end of file
......@@ -45,7 +45,7 @@ type Config struct {
Language string `yaml:"LANG"`
LanguageCode string `yaml:"LANGUAGE_CODE"` // Abandon
UploadFailedReplay bool `yaml:"UPLOAD_FAILED_REPLAY_ON_START"`
LoadPolicy string `yaml:"LOAD_POLICY"` // all, pagination
AssetLoadPolicy string `yaml:"ASSET_LOAD_POLICY"` // all
}
func (c *Config) EnsureConfigValid() {
......@@ -101,7 +101,7 @@ func (c *Config) LoadFromEnv() error {
}
func (c *Config) Load(filepath string) error {
if err := c.LoadFromYAMLPath(filepath); err == nil{
if err := c.LoadFromYAMLPath(filepath); err == nil {
return err
}
log.Print("Load from env")
......@@ -134,6 +134,7 @@ var Conf = &Config{
SftpRoot: "/tmp",
ShowHiddenFile: false,
ReuseConnection: true,
AssetLoadPolicy: "",
}
func SetConf(conf *Config) {
......
......@@ -63,12 +63,12 @@ type interactiveHandler struct {
offset int
limit int
loadDataDone chan struct{}
loadPolicy string
loadDataDone chan struct{}
assetLoadPolicy string
}
func (h *interactiveHandler) Initial() {
h.loadPolicy = config.GetConf().LoadPolicy
h.assetLoadPolicy = strings.ToLower(config.GetConf().AssetLoadPolicy)
h.displayBanner()
h.winWatchChan = make(chan bool)
h.loadDataDone = make(chan struct{})
......@@ -77,7 +77,7 @@ func (h *interactiveHandler) Initial() {
func (h *interactiveHandler) firstLoadData() {
h.loadUserNodes("1")
switch h.loadPolicy {
switch h.assetLoadPolicy {
case "all":
h.loadAllAssets()
}
......@@ -184,7 +184,7 @@ func (h *interactiveHandler) Dispatch(ctx cctx.Context) {
}
func (h *interactiveHandler) displayAllAssets() {
switch h.loadPolicy {
switch h.assetLoadPolicy {
case "all":
<-h.loadDataDone
h.displayAssets(h.allAssets)
......@@ -270,7 +270,7 @@ func (h *interactiveHandler) displayNodes(nodes []model.Node) {
}
func (h *interactiveHandler) refreshAssetsAndNodesData() {
switch h.loadPolicy {
switch h.assetLoadPolicy {
case "all":
h.loadAllAssets()
}
......@@ -290,7 +290,7 @@ func (h *interactiveHandler) loadAllAssets() {
}
func (h *interactiveHandler) searchAsset(key string) {
switch h.loadPolicy {
switch h.assetLoadPolicy {
case "all":
<-h.loadDataDone
var searchData []model.Asset
......@@ -321,7 +321,7 @@ func (h *interactiveHandler) searchAssetOrProxy(key string) {
}
}
var assets []model.Asset
switch h.loadPolicy {
switch h.assetLoadPolicy {
case "all":
<-h.loadDataDone
var searchData []model.Asset
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment