215 lines
4.8 KiB
YAML
215 lines
4.8 KiB
YAML
# 数据库动态渲染系统 - 配置文件示例
|
|
# 支持数据库类型: sqlite, mysql, postgres
|
|
|
|
database:
|
|
type: sqlite # 数据库类型: sqlite, mysql, postgres
|
|
path: ./data/app.db # SQLite数据库文件路径
|
|
# MySQL配置示例
|
|
# type: mysql
|
|
# host: localhost
|
|
# port: 3306
|
|
# user: root
|
|
# password: password
|
|
# dbname: testdb
|
|
# PostgreSQL配置示例
|
|
# type: postgres
|
|
# host: localhost
|
|
# port: 5432
|
|
# user: postgres
|
|
# password: password
|
|
# dbname: testdb
|
|
|
|
# 模板系统配置
|
|
templates:
|
|
custom_path: "./web/templates/custom" # 自定义模板目录
|
|
cache_enabled: true # 启用模板缓存
|
|
hot_reload: false # 开发环境下启用热重载
|
|
builtin_path: "./web/templates/builtin" # 内置模板目录
|
|
|
|
# 模板定义配置
|
|
templates:
|
|
articles:
|
|
name: "文章列表"
|
|
type: "list"
|
|
description: "技术文章列表视图"
|
|
fields:
|
|
title: "string"
|
|
content: "markdown"
|
|
category: "category"
|
|
tags: "tag"
|
|
created_at: "time"
|
|
config:
|
|
page_size: 15
|
|
show_pagination: true
|
|
|
|
logs:
|
|
name: "系统日志"
|
|
type: "table"
|
|
description: "系统日志表格视图"
|
|
fields:
|
|
level: "tag"
|
|
message: "string"
|
|
timestamp: "time"
|
|
config:
|
|
page_size: 50
|
|
show_filter: true
|
|
|
|
users:
|
|
name: "用户管理"
|
|
type: "card"
|
|
description: "用户卡片视图"
|
|
fields:
|
|
username: "string"
|
|
email: "string"
|
|
role: "tag"
|
|
created_at: "time"
|
|
config:
|
|
page_size: 12
|
|
show_avatar: true
|
|
|
|
# 模板类型配置
|
|
template_types:
|
|
list:
|
|
layout: "table"
|
|
fields:
|
|
default: "raw"
|
|
time: "time"
|
|
markdown: "markdown"
|
|
tag: "tag"
|
|
category: "category"
|
|
options:
|
|
striped: true
|
|
hover: true
|
|
border: true
|
|
|
|
card:
|
|
layout: "grid"
|
|
fields:
|
|
default: "raw"
|
|
time: "relative"
|
|
markdown: "excerpt"
|
|
tag: "badge"
|
|
category: "chip"
|
|
options:
|
|
columns: "3"
|
|
spacing: "md"
|
|
|
|
timeline:
|
|
layout: "timeline"
|
|
fields:
|
|
default: "raw"
|
|
time: "relative"
|
|
markdown: "summary"
|
|
tag: "status"
|
|
category: "timeline"
|
|
options:
|
|
direction: "vertical"
|
|
alignment: "left"
|
|
|
|
# 数据表配置
|
|
tables:
|
|
articles:
|
|
alias: "技术文章"
|
|
layout: "card" # 默认布局: card, list, timeline
|
|
page_size: 15
|
|
template: "card" # 默认模板类型
|
|
custom_templates: # 自定义模板映射
|
|
list: "custom/articles/list.html"
|
|
card: "custom/articles/card.html"
|
|
field_renderers: # 字段渲染器映射
|
|
content: "custom/articles/field/markdown.html"
|
|
tags: "custom/articles/field/tag.html"
|
|
|
|
columns:
|
|
- name: "id"
|
|
alias: "ID"
|
|
type: "int"
|
|
primary: true
|
|
hidden: false
|
|
- name: "title"
|
|
alias: "标题"
|
|
type: "string"
|
|
searchable: true
|
|
max_length: 50
|
|
- name: "content"
|
|
alias: "内容"
|
|
type: "text"
|
|
render_type: "markdown"
|
|
hidden: true # 不在列表中显示,详情页显示
|
|
- name: "category"
|
|
alias: "分类"
|
|
type: "string"
|
|
searchable: true
|
|
render_type: "category"
|
|
- name: "tags"
|
|
alias: "标签"
|
|
type: "string"
|
|
render_type: "tag"
|
|
values:
|
|
1:
|
|
label: "Go"
|
|
color: "#00ADD8"
|
|
2:
|
|
label: "JavaScript"
|
|
color: "#f7df1e"
|
|
3:
|
|
label: "Python"
|
|
color: "#3776ab"
|
|
- name: "created_at"
|
|
alias: "发布时间"
|
|
type: "datetime"
|
|
render_type: "time"
|
|
format: "2006-01-02 15:04:05"
|
|
|
|
logs:
|
|
alias: "系统日志"
|
|
layout: "list"
|
|
page_size: 50
|
|
|
|
columns:
|
|
- name: "id"
|
|
alias: "ID"
|
|
type: "int"
|
|
primary: true
|
|
hidden: false
|
|
- name: "level"
|
|
alias: "级别"
|
|
type: "int"
|
|
render_type: "tag"
|
|
values:
|
|
1:
|
|
label: "INFO"
|
|
color: "#52c41a"
|
|
2:
|
|
label: "WARN"
|
|
color: "#faad14"
|
|
3:
|
|
label: "ERROR"
|
|
color: "#f5222d"
|
|
- name: "message"
|
|
alias: "日志信息"
|
|
type: "text"
|
|
max_length: 100
|
|
- name: "timestamp"
|
|
alias: "时间"
|
|
type: "datetime"
|
|
render_type: "time"
|
|
format: "2006-01-02 15:04:05"
|
|
|
|
app:
|
|
name: "数据库动态渲染系统"
|
|
theme: "modern"
|
|
language: "zh-CN"
|
|
port: 8080
|
|
|
|
# 日志配置
|
|
logging:
|
|
level: "info" # debug, info, warn, error
|
|
format: "json" # json, text
|
|
output: "stdout" # stdout, stderr, file
|
|
|
|
# 服务器配置
|
|
server:
|
|
read_timeout: 30s
|
|
write_timeout: 30s
|
|
idle_timeout: 60s |