快速搭建Dev / Test / Porduct 环境妙招--Star.hou

团队常面临代码生成流程问题,使用Nginx、Apache等HTTP服务软件时,可自定义开发语言环境变量。能实现PHP、Java等项目配置文件和环境区分,快速区分开发、测试、生产环境,具有改动代码少、便于维护、多套环境隔离且逻辑清晰等好处。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

每个团队都会面临代码生成流程环节问题,使用nginx apache等http服务软件时候,可以自定义开发语言的环境变量。


实现:PHP、Java等项目配置文件和环境区分。

Aapche

SetEnv APP_ENV dev

Nginx

fasgcgi_param APP_ENV test

tomcat java

开发配置

if(isset($_SERVER['APP_ENV']) && $_SERVER['APP_ENV'] == 'dev'){
    $config    = require 'config_dev.php';
}
  1. 快速区分开发、测试、生产环境。 好处
  2. 改动最少的程序代码,便于维护。 好处
  3. 多套环境隔离,逻辑清晰。
set -e export RLM_LICENSE="10.247.222.136@5053" cd ${WORKSPACE}/code chmod 755 ${WORKSPACE}/code/build.sh if [ $? -eq 0 ];then echo "build.sh file exists" else echo "no file build.sh or permission deny" exit fi if [ "${product_name}" = "ICSD_YB" ];then bash ${WORKSPACE}/code/build.sh -v ${product_name} ${boot_url} ${osd_url} elif [ "${product_name}" = "ICSD_ZK" ];then bash ${WORKSPACE}/code/build.sh -v ${product_name} ${boot_url} ${tp_url} elif [ "${product_branch}" = "br_ichs_2.0.0_release" ];then if [ "${mr_release}" = "F2" ];then bash ${WORKSPACE}/code/build.sh -v ICHS_F2 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.007-1500300.B010/ICHS_F2_MPC584BX_BOOTLOADER_V11.tar.gz?_t=1715572255931 elif [ "${mr_release}" = "X2" ];then bash ${WORKSPACE}/code/build.sh -v ICHS_X2 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.004-1710300.B010/ICHS_X2_MPC584BX_BOOTLOADER_V13.tar.gz?_t=1712573054471 elif [ "${mr_release}" = "X4" ];then bash ${WORKSPACE}/code/build.sh -v ICHS_X4 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.006-0100400.B010/ICHS_X4_MPC584BX_BOOTLOADER_V6.tar.gz?_t=1712461946857 elif [ "${mr_release}" = "F3" ];then bash ${WORKSPACE}/code/build.sh -v ICHS_F3 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1501300.B004/ICHS_F3_MPC584BX_BOOTLOADER_V2.tar.gz?_t=1717654488502 elif [ "${mr_release}" = "F1A" ];then bash ${WORKSPACE}/code/build.sh -v ICHS_F1A https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1502200.B001/ICHS_F1A_MPC584BX_BOOTLOADER_V1.tar.gz?_t=1723453286790 elif [ "${mr_release}" = "F2H" ];then bash ${WORKSPACE}/code/build.sh -v ICHS_F2H https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1500290.B010/ICHS_F2H_MPC584BX_BOOTLOADER_V1.tar.gz?_t=1737463266641 elif [ "${mr_release}" = "F1CH" ];then bash ${WORKSPACE}/code/build.sh -v ICHS_F1CH https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1502700.B010/ICHS_F1CH_MPC584BX_BOOTLOADER_V1.tar.gz?_t=1739350995574 else echo "porduct error" fi else bash ${WORKSPACE}/code/build.sh -v ${product_name} ${boot_url} fi 帮我转换成python脚本
03-21
#!/bin/bash set -e cd ${WORKSPACE}/code export RLM_LICENSE="10.247.222.136@5053" if [ "${product_name}" = "ICSD_YB" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ${product_name} ${boot_url} ${osd_url} elif [ "${product_name}" = "ICSD_ZK" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ${product_name} ${boot_url} ${tp_url} elif [ "${product_branch}" = "br_ichs_2.0.0_release" ];then if [ "${mr_release}" = "F2" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ICHS_F2 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.007-1500300.B010/ICHS_F2_MPC584BX_BOOTLOADER_V11.tar.gz?_t=1715572255931 elif [ "${mr_release}" = "X2" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ICHS_X2 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.004-1710300.B010/ICHS_X2_MPC584BX_BOOTLOADER_V13.tar.gz?_t=1712573054471 elif [ "${mr_release}" = "X4" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ICHS_X4 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.006-0100400.B010/ICHS_X4_MPC584BX_BOOTLOADER_V6.tar.gz?_t=1712461946857 elif [ "${mr_release}" = "F3" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ICHS_F3 https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1501300.B004/ICHS_F3_MPC584BX_BOOTLOADER_V2.tar.gz?_t=1717654488502 elif [ "${mr_release}" = "F1A" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ICHS_F1A https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1502200.B001/ICHS_F1A_MPC584BX_BOOTLOADER_V1.tar.gz?_t=1723453286790 elif [ "${mr_release}" = "F2H" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ICHS_F2H https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1500290.B010/ICHS_F2H_MPC584BX_BOOTLOADER_V1.tar.gz?_t=1737463266641 elif [ "${mr_release}" = "F1CH" ];then bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ICHS_F1CH https://cmc-szver-artifactory.cmc.tools.huawei.com/artifactory/cmc-sz-inner/ICHS/ICHS%20200/ICHS%20200.0.001-1502700.B010/ICHS_F1CH_MPC584BX_BOOTLOADER_V1.tar.gz?_t=1739350995574 else echo "porduct error" fi else bash /opt/buildtools/PclintClangtidyToolBox/bin/all.sh -v ${product_name} ${boot_url} fi 帮我转换成python脚本
最新发布
03-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值