From 52511dfbddb6e209c4df2401686dc7e9d322aba5 Mon Sep 17 00:00:00 2001 From: 16337 <1633794139@qq.com> Date: Thu, 19 Mar 2026 10:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=EF=BC=9A=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=95=8F=E6=84=9F=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=B7=9F?= =?UTF-8?q?=E8=B8=AA=EF=BC=8C=E6=B7=BB=E5=8A=A0=20example=20=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - application-dev.yml 含数据库/Redis/COS 密钥,从 git 移除 - docker/.env 含 COS 密钥和公网 IP,从 git 移除 - 新增 .example 模板(占位符),方便新开发者配置 - .gitignore 添加规则阻止未来误提交 --- .gitignore | 6 + docker/{.env => .env.example} | 10 +- src/main/resources/application-dev.yml | 152 ------------------ .../resources/application-dev.yml.example | 95 +++++++++++ 4 files changed, 106 insertions(+), 157 deletions(-) rename docker/{.env => .env.example} (59%) delete mode 100644 src/main/resources/application-dev.yml create mode 100644 src/main/resources/application-dev.yml.example diff --git a/.gitignore b/.gitignore index f89461665..996a40e9d 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,9 @@ generate_*.py # Documentation (keep local, do not commit) docs/ + +# 敏感配置文件(含密码/密钥,不入库) +src/main/resources/application-dev.yml +docker/.env +.env +.env.local diff --git a/docker/.env b/docker/.env.example similarity index 59% rename from docker/.env rename to docker/.env.example index d5deb54bb..6914614bb 100644 --- a/docker/.env +++ b/docker/.env.example @@ -12,7 +12,7 @@ SIP_ShowIP=127.0.0.1 SIP_Port=8160 SIP_Domain=3502000000 SIP_Id=35020000002000000001 -SIP_Password=wvp_sip_password +SIP_Password=your-sip-password RecordSip=true @@ -20,9 +20,9 @@ RecordPushLive= # COS 截图代理(腾讯云 COS) COS_REGION=ap-shanghai -COS_BUCKET=xhwkzx-1-1389966313 -COS_SECRET_ID=AKIDVxPiqmVhYv7FCwVqytdAVddQ2TJySt9I -COS_SECRET_KEY=1rVyEI8mMVWs21xfBUjy4BE6DA4z7KWb +COS_BUCKET=your-bucket-name +COS_SECRET_ID=your-cos-secret-id +COS_SECRET_KEY=your-cos-secret-key # AI 截图回调地址 -AI_SCREENSHOT_CALLBACK_URL=http://124.221.55.225:18080 \ No newline at end of file +AI_SCREENSHOT_CALLBACK_URL=http://your-server:18080 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml deleted file mode 100644 index 671512501..000000000 --- a/src/main/resources/application-dev.yml +++ /dev/null @@ -1,152 +0,0 @@ -spring: - # 设置接口超时时间 - mvc: - async: - request-timeout: 20000 - thymeleaf: - cache: false - # [可选]上传文件大小限制 - servlet: - multipart: - max-file-size: 10MB - max-request-size: 100MB - cache: - type: redis - data: - # REDIS数据库配置 - redis: - # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 - host: 127.0.0.1 - # [必须修改] 端口号 - port: 6379 - # [可选] 数据库 DB - database: 0 - # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 - # password: - # [可选] 超时时间 - timeout: 10000 - # mysql数据源 - datasource: - type: com.zaxxer.hikari.HikariDataSource - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true - username: wvp_user - password: wvp_password - # h2数据库 - # datasource: - # driver-class-name: org.h2.Driver - # url: jdbc:h2:mem:wvp - # username: sa - # password: 12345678 - # sql: - # init: - # # 启动时仅初始化内置的数据库,例如h2:mem - # mode: embedded - # schema-locations: file:数据库/2.7.4-h2/h2-schema.sql - # data-locations: file:数据库/2.7.4-h2/h2-data.sql - # # h2数据库控制台,请注意仅在测试环境下使用! - # h2: - # console: - # enabled: true -#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 -server: - port: 18080 - # [可选] HTTPS配置, 默认不开启 - ssl: - # [可选] 是否开启HTTPS访问 - enabled: false - # [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名 - key-store: classpath:test.monitor.89iot.cn.jks - # [可选] 证书密码 - key-store-password: gpf64qmw - # [可选] 证书类型, 默认为jks,根据实际修改 - key-store-type: JKS - -# 作为28181服务器的配置 -sip: - # [可选] 28181服务监听的端口 - port: 8116 - # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) - # 后两位为行业编码,定义参照附录D.3 - # 3701020049标识山东济南历下区 信息行业接入 - # [可选] - domain: 4101050000 - # [可选] - id: 41010500002000000001 - # [可选] 公共认证密码 移除密码将必须提前添加设备才能通过认证 - password: 12345678 - # 是否存储alarm信息 - alarm: false - -#zlm 默认服务器配置 -media: - id: zlmediakit-local - # [必须修改] zlm服务器的内网IP - ip: 127.0.0.1 - # [必须修改] zlm服务器的http.port - http-port: 6080 - # [必选选] zlm服务器的hook.admin_params=secret - secret: su6TiedN2rVAmBbIDX0aa0QTiBJLBdcf - # [重要] ZLM在Docker内运行时,hook回调需用host.docker.internal才能访问宿主机 - hook-ip: host.docker.internal - # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 - rtp: - # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 - enable: true - # [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功 - port-range: 40000,45000 # 端口范围 - # [可选] 国标级联在此范围内选择端口发送媒体流, - send-port-range: 50000,55000 # 端口范围 -# [根据业务需求配置] -user-settings: - # 点播/录像回放 等待超时时间,单位:毫秒 - play-timeout: 180000 - # [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true - auto-apply-play: true - # 推流直播是否录制 - record-push-live: true - # 国标是否录制 - record-sip: true - # 国标点播 按需拉流, true:有人观看拉流,无人观看释放, false:拉起后不自动释放 - stream-on-demand: true - # 是否返回Date属性,true:不返回,避免摄像头通过该参数自动校时,false:返回,摄像头可能会根据该时间校时 - disable-date-header: false - -# AI边缘端服务配置 -ai: - service: - # FastAPI边缘端地址 - url: http://127.0.0.1:9001 - # 推送超时ms - push-timeout: 10000 - # 暂未对接时设为false - enabled: true - screenshot: - # Edge截图回调地址(WVP外部可访问地址,Edge通过此地址回调截图结果) - callback-url: http://124.221.55.225:18080 - cos: - secret-id: - secret-key: - region: ap-beijing - bucket: - mqtt: - # MQTT推送开关 - enabled: false - # EMQX Broker地址 - - broker: tcp://127.0.0.1:1883 - # 客户端ID - client-id: wvp-server - # 认证用户名 - username: wvp - # 认证密码 - password: wvp123 - # topic前缀 - topic-prefix: ai/config - # QoS级别 - qos: 1 - # 连接超时(秒) - connect-timeout: 10 - # 心跳间隔(秒) - keep-alive: 60 - diff --git a/src/main/resources/application-dev.yml.example b/src/main/resources/application-dev.yml.example new file mode 100644 index 000000000..12868b52b --- /dev/null +++ b/src/main/resources/application-dev.yml.example @@ -0,0 +1,95 @@ +spring: + # 设置接口超时时间 + mvc: + async: + request-timeout: 20000 + thymeleaf: + cache: false + # [可选]上传文件大小限制 + servlet: + multipart: + max-file-size: 10MB + max-request-size: 100MB + cache: + type: redis + data: + # REDIS数据库配置 + redis: + # [必须修改] Redis服务器地址 + host: 127.0.0.1 + # [必须修改] 端口号 + port: 6379 + # [可选] 数据库 DB + database: 0 + # [可选] 访问密码 + # password: your-redis-password + # [可选] 超时时间 + timeout: 10000 + # mysql数据源 + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true + username: your-db-username + password: your-db-password + +#[可选] WVP监听的HTTP端口 +server: + port: 18080 + ssl: + enabled: false + key-store: classpath:test.monitor.89iot.cn.jks + key-store-password: your-keystore-password + key-store-type: JKS + +# 作为28181服务器的配置 +sip: + port: 8116 + domain: 4101050000 + id: 41010500002000000001 + password: 12345678 + alarm: false + +#zlm 默认服务器配置 +media: + id: zlmediakit-local + ip: 127.0.0.1 + http-port: 6080 + secret: your-zlm-secret + hook-ip: host.docker.internal + rtp: + enable: true + port-range: 40000,45000 + send-port-range: 50000,55000 + +user-settings: + play-timeout: 180000 + auto-apply-play: true + record-push-live: true + record-sip: true + stream-on-demand: true + disable-date-header: false + +# AI边缘端服务配置 +ai: + service: + url: http://127.0.0.1:9001 + push-timeout: 10000 + enabled: true + screenshot: + callback-url: http://127.0.0.1:18080 + cos: + secret-id: your-cos-secret-id + secret-key: your-cos-secret-key + region: ap-shanghai + bucket: your-bucket-name + mqtt: + enabled: false + broker: tcp://127.0.0.1:1883 + client-id: wvp-server + username: wvp + password: your-mqtt-password + topic-prefix: ai/config + qos: 1 + connect-timeout: 10 + keep-alive: 60