update readme

This commit is contained in:
BaoXuebin 2021-12-06 22:07:19 +08:00
parent e8e65abe2a
commit 05b5b67f93
3 changed files with 57 additions and 11 deletions

View File

@ -29,11 +29,47 @@
## 如何使用 ## 如何使用
**本地打包**
1. 克隆本项目到本地
2. 根目录执行 `go build`
3. 执行 `./beancount-gs` (`-p` 指定端口号,`-secret` 指定配置密钥)
**release**
1. 下载并解压项目的 `release`
2. 执行根目录下的 `./beancount-gs.exe`
**docker**
```shell ```shell
go build docker run --name benacount-gs -dp 10000:80 \
-w /app \
-v "/data/beancount:/data/beancount" \
-v "/data/beancount/icons:/app/public/icons" \
-v "/data/beancount/config:/app/config" \
xdbin/beancount-gs:latest \
sh -c "cp -rn /app/public/default_icons/* /app/public/icons && ./beancount-gs -p 80"
``` ```
将打包获得的文件与项目的 `config/`, `public/`, `example/` 三个文件夹放置同一目录,然后执行 **docker-compose**
```yaml
version: "3.9"
services:
app:
container_name: beancount-gs
image: xdbin/beancount-gs:latest
ports:
- "10000:80"
# volumes 挂载目录会导 /app/public/icons 中的图标被覆盖,这里将默认图标在挂载后重新拷贝图标
command: >
sh -c "cp -rn /app/public/default_icons/* /app/public/icons && ./beancount-gs -p 80"
volumes:
- "${dataPath:-/data/beancount}:${dataPath:-/data/beancount}"
- "${dataPath:-/data/beancount}/icons:/app/public/icons"
- "${dataPath:-/data/beancount}/config:/app/config"
```
## 项目负责人 ## 项目负责人

View File

@ -1 +0,0 @@
[]

View File

@ -71,14 +71,25 @@ func LoadServerConfig() error {
LogSystemInfo("Success load config file (" + filePath + ")") LogSystemInfo("Success load config file (" + filePath + ")")
// load white list // load white list
whiteListFilePath := GetServerWhiteListFilePath() whiteListFilePath := GetServerWhiteListFilePath()
fileContent, err = ReadFile(whiteListFilePath) if FileIfExist(whiteListFilePath) {
if err != nil { fileContent, err = ReadFile(whiteListFilePath)
return err if err != nil {
} return err
err = json.Unmarshal(fileContent, &whiteList) }
if err != nil { err = json.Unmarshal(fileContent, &whiteList)
LogSystemError("Failed unmarshal whitelist file (" + whiteListFilePath + ")") if err != nil {
return err LogSystemError("Failed unmarshal whitelist file (" + whiteListFilePath + ")")
return err
}
} else {
file, _ := os.OpenFile(whiteListFilePath, os.O_CREATE, 0644)
_, err = file.WriteString("[]")
if err != nil {
LogSystemError("Failed to create whitelist file (" + whiteListFilePath + ")")
return err
}
whiteList = make([]string, 0)
defer file.Close()
} }
LogSystemInfo("Success load whitelist file (" + whiteListFilePath + ")") LogSystemInfo("Success load whitelist file (" + whiteListFilePath + ")")
return nil return nil