Skip to main content
Glama
01.SpringBoot配置.md9.84 kB
--- title: "SpringBoot配置" date: "2022-01-29T20:46:22.000Z" permalink: "/pages/config/spring-boot/" --- # 完整配置示例 magic-api: web: /magic/web # UI请求的界面以及UI服务地址 resource: #配置存储方式 type: database # 配置存储在数据库中 tableName: magic_api_file # 数据库中的表名 datasource: magic #指定数据源(单数据源时无需配置,多数据源时默认使用主数据源,如果存在其他数据源中需要指定。) prefix: /magic-api # key前缀 readonly: false # 是否是只读模式 prefix: / # 接口前缀,可以不配置 auto-import-module: db # 自动导入的模块 auto-import-package: java.lang.*,java.util.* #自动导包 allow-override: false #禁止覆盖应用接口 sql-column-case: camel #启用驼峰命名转换 editor-config: classpath:./magic-editor.js #编辑器配置 support-cross-domain: true # 跨域支持,默认开启 secret-key: 123456789 # 远程推送时的秘钥,未配置则不开启推送 push-path: /_magic-api-sync #远程推送的路径,默认为/_magic-api-sync show-sql: true #配置打印SQL compile-cache-size: 500 #配置编译缓存容量 persistence-response-body: true #是否持久化保存ResponseBody date-pattern: # 配置请求参数支持的日期格式 - yyyy-MM-dd - yyyy-MM-dd HH:mm:ss - yyyyMMddHHmmss - yyyyMMdd response: |- #配置JSON格式,格式为magic-script中的表达式 { code: code, message: message, data, timestamp, requestTime, executeTime, } response-code: success: 1 #执行成功的code值 invalid: 0 #参数验证未通过的code值 exception: -1 #执行出现异常的code值 banner: true # 打印banner thread-pool-executor-size: 8 # async语句的线程池大小 throw-exception: false #执行出错时是否抛出异常 backup: #备份相关配置 enable: true #是否启用 max-history: -1 #备份保留天数,-1为永久保留 datasource: magic #指定数据源(单数据源时无需配置,多数据源时默认使用主数据源,如果存在其他数据源中需要指定。) table-name: magic_api_backup #使用数据库存储备份时的表名 crud: # CRUD相关配置 logic-delete-column: deleted #逻辑删除列 logic-delete-value: 1 #逻辑删除值 cache: # 缓存相关配置 capacity: 10000 #缓存容量 ttl: -1 # 永不过期 enable: true # 启用缓存 page: size: size # 页大小的参数名称 page: page # 页码的参数名称 default-page: 1 # 未传页码时的默认首页 default-size: 10 # 未传页大小时的默认页大小 security: # 安全配置 username: admin # 登录用的用户名 password: 123456 # 登录用的密码 swagger: version: 1.0 description: MagicAPI 接口信息 title: MagicAPI Swagger Docs name: MagicAPI 接口 location: /v2/api-docs/magic-api/swagger2.json debug: timeout: 60 # 断点超时时间,默认60s # prefix * 类型:String * 默认值:null magic-api.prefix 接口路径的前缀,可空 # web * 类型:String * 默认值:null magic-api.web WEB页面的请求路径,可空,填写时开启,否则不开启,生产环境建议不开启 # resource # type * 类型: String * 默认值: file magic-api.resource.type 资源存储类型,默认为存文件,可选file、database、redis # location * 类型: String * 默认值: /data/magic-api magic-api.resource.location 文件存储位置,此项配置为file专用,当以classpath: 开头时,则可以读jar内资源,且为只读模式(一般部署使用)。 # tableName * 类型: String * 默认值: magic_api_file magic-api.resource.tableName 数据库存储时使用的表名,此项为database专用 # datasource * 类型: String * 默认值:null magic-api.resource.datasource指定数据源(单数据源时无需配置,多数据源时默认使用主数据源,如果存在其他数据源中需要指定。) # prefix * 类型: String * 默认值: magic-api magic-api.resource.prefix 使用database、redis存储时的key前缀 # readonly * 类型: boolean * 默认值: false magic-api.resource.readonly 是否为只读模式 # support-cross-domain * 类型: Boolean * 默认值: true magic-api.support-cross-domain 是否支持跨域,默认开启 # response * 类型: String * 默认值: null magic-api.response 配置JSON序列化格式,值为magic-script中的表达式 # secret-key * 类型: String * 默认值: null magic-api.secret-key 远程推送时的秘钥,未配置则不开启 # push-path * 类型: String * 默认值: /_magic-api-sync magic-api.push-path 远程推送的路径,默认为/_magic-api-sync # show-sql * 类型: Boolean * 默认值:true magic-api.show-sql 是否打印SQL,默认为true # date-pattern * 类型: String[] * 默认值:[{"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyyMMddHHmmss", "yyyyMMdd"}] magic-api.date-pattern 请求参数支持的日期格式 # compile-cache-size * 类型:int * 默认值:500 magic-api.compile-cache-size 编译缓存容量 # instance-id * 类型: String * 默认值: null magic-api.instance-id 实例id,要保证每台机器都不同,默认启动后随机生成uuid,如果无特殊需要则不需要配置 # persistence-response-body * 类型:boolean * 默认值:true magic-api.persistence-response-body 是否持久化保存ResponseBody # backup # enable * 类型: Boolean * 默认值: false magic-api.backup.enable 是否启用备份 # table-name * 类型: String * 默认值: null magic-api.backup.table-name 使用数据库时,存储备份的表名 # datasource * 类型: String * 默认值: null magic-api.backup.datasource 指定数据源(单数据源时无需配置,多数据源时默认使用主数据源,如果存在其他数据源中需要指定。) # max-history * 类型: int * 默认值: -1 magic-api.backup.max-history 备份保留天数,-1为永久保留 # response-code # success * 类型: int * 默认值: 1 magic-api.response-code.success 执行成功的code值 # invalid * 类型: int * 默认值: 0 magic-api.response-code.invalid 参数验证未通过的code值 # exception * 类型: int * 默认值: -1 magic-api.response-code.exception 执行出现异常的code值 # banner * 类型:boolean * 默认值:true magic-api.banner 是否打印banner # throw-exception * 类型:boolean * 默认值:false magic-api.throw-exception 执行出现异常时是否抛出异常(默认不抛出异常) # editor-config * 类型:String * 默认值:null(默认不配置) magic-api.editor-config 编辑器配置文件路径,具体请参考magic-editor配置 # auto-import-module * 类型:String * 默认值:db(默认导入db模块,多个值时用","分隔) magic-api.auto-import-module 默认导入的模块 # auto-import-package * 类型:String * 默认值:null,java.lang.*,java.util.*转为内置自动导入 magic-api.auto-import-package 默认导入的包 # allow-override * 类型:boolean * 默认值:false magic-api.allow-override 是否允许覆盖应用接口 # thread-pool-executor-size * 类型:int * 默认值 : 0 <=0 表示CPU 核心数 * 2 magic-api.thread-pool-executor-size 异步调用的线程池大小 # sql-column-case * 类型:string * 默认值 : default magic-api.sql-column-case 列名转换规则 # 可选值 * default (保持原样) * camel (驼峰命名) * pascal (帕斯卡命名) * upper (全大写) * lower (全小写) # crud CRUD相关配置 # logic-delete-column magic-api.crud.logic-delete-column 逻辑删除列,在单表API中使用logic后,删除语句会转为update,查询语句会多拼接一个条件 # logic-delete-value magic-api.crud.logic-delete-column 逻辑删除值 # page 分页配置 # page * 类型:string * 默认值:page magic-api.page.page页码参数名 # size * 类型:string * 默认值:size magic-api.page.size页大小参数名 # default-page * 类型:long * 默认值:1 magic-api.page.default-page取不到页码参数时的默认页码 # default-size * 类型:long * 默认值:10 magic-api.page.default-size取不到页大小参数时的默认页大小 # cache 缓存配置 # enable * 类型:boolean * 默认值:false magic-api.cache.enable是否开启缓存(默认缓存实现是LRU+TTL) # capacity * 类型:long * 默认值:10000 magic-api.cache.capacity缓存容量 # ttl * 类型:long * 默认值:-1 magic-api.cache.ttl缓存过期时间,默认是-1即永不过期 # debug DEBUG配置 # timeout * 类型:int * 默认值:60 magic-api.debug.timeoutDEBUG断点等待时间,单位秒,默认为60秒 # swagger Swagger 配置 # name * 类型:string * 默认值:MagicAPI接口 magic-api.swagger.name 资源名称 # location * 类型:string * 默认值:/v2/api-docs/magic-api/swagger2.json magic-api.swagger.location 资源位置 # title * 类型:string * 默认值:MagicAPI Swagger Docs magic-api.swagger.title 文档标题 # description * 类型:string * 默认值:MagicAPI 接口信息 magic-api.swagger.description 文档描述 # version * 类型:string * 默认值:1.0 magic-api.swagger.version 文档版本 # security 安全配置 # username * 类型: string * 默认值: null magic-api.security.username 配置登录用的用户名,当用户名和密码都配置时,页面需登录才能访问 # password * 类型: string * 默认值: null magic-api.security.password 配置登录用的密码,当用户名和密码都配置时,页面需登录才能访问

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dwsy/magic-api-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server