Sync the「cat」config backend server
CatSync 正在努力向V2版本过渡, 尽可能保证功能的向后兼容性, 但是配置文件会有破坏性更新,
请根据下方配置类型和报错提示进行响应修改
目前我们正在处于beta版本
如果您想体验请使用docker run -d -p 3000:3000 -v ./data:/app/data:ro --name catsync ghcr.io/sn0wo2/catsync:beta-latest
或者将docker-compose.yml中的image字段替换为ghcr.io/sn0wo2/catsync:beta-latest
或者从 https://github.com/Sn0wo2/CatSync/releases 下载最新的beta版本
这是我们最新的更新计划: TODO
// config/types.go
type Config struct {
Log Log `json:"log" yaml:"log"`
Server Server `json:"server" yaml:"server"`
Actions []Action `json:"actions" yaml:"actions"`
}
type Log struct {
Dir string `json:"dir" optional:"true" yaml:"dir"`
Level string `json:"level" optional:"true" yaml:"level"`
FileFormat string `json:"fileFormat" yaml:"fileFormat"`
}
type Server struct {
Address string `json:"address" yaml:"address"`
Header string `json:"header" optional:"true" yaml:"header"`
TLS *ServerTLS `json:"tls" optional:"true" yaml:"tls"`
}
type ServerTLS struct {
Cert string `json:"cert" yaml:"cert"`
Key string `json:"key" yaml:"key"`
}
type Action struct {
Route string `json:"route" yaml:"route"`
ResponseHeader *http.Header `json:"responseHeader" optional:"true" yaml:"responseHeader"`
Auth *ActionAuth `json:"auth" optional:"true" yaml:"auth"`
Type ActionType `json:"type" yaml:"type"`
// --- Action Data ---
ActionFile *ActionFileData `json:"file" optional:"true" yaml:"file"`
ActionString *ActionStringData `json:"string" optional:"true" yaml:"string"`
}
type ActionAuth struct {
Header map[string][]string `json:"header" optional:"true" yaml:"header"`
Query map[string]string `json:"query" optional:"true" yaml:"query"`
}
type ActionType string
const (
ActionFile ActionType = "file"
ActionString ActionType = "string"
)
type ActionData interface {
data()
}
type ActionFileData struct {
ActionVersionModifier `json:"actionVersionModifier" optional:"true" yaml:"actionVersionModifier"`
Path string `json:"path" yaml:"path"`
}
func (a *ActionFileData) data() {}
type ActionStringData struct {
ActionVersionModifier `json:"actionVersionModifier" optional:"true" yaml:"actionVersionModifier"`
Content string `json:"content" yaml:"content"`
}
func (a *ActionStringData) data() {}
type ActionVersionModifier struct {
Placeholder string `json:"placeholder" yaml:"placeholder"`
}# Recommend~
make run_docker
# Or Replace 'latest' with local image to use your self-built images
docker run -d -p 3000:3000 -v ./data:/app/data:ro --name catsync ghcr.io/sn0wo2/catsync:latest# Recommend~
make test_goreleaser
# Or
go build -o CatSync ./cmd
docker build -t catsync:local .