定制 xenomedia/xeno_config_split 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xenomedia/xeno_config_split

Composer 安装命令:

composer require xenomedia/xeno_config_split

包简介

Creates xeno media configuration split settings

README 文档

README

Background

Xeno Media builds tons of sites. This module allows all our sites to quickly create a unified config split accross all our sites.

Installation

Install the module:

composer require drupal/config_split
composer require drupal/config_ignore
composer require xenomedia/xeno_config_split

Enable the modules:

drush en xeno_config_split -y

Create/update drush/policy.drush.inc file:

<?php

/**
 * @file
 * Drush policies.
 */

/**
 * Implementation of drush_hook_COMMAND_validate().
 */
function drush_policy_config_import_validate($source = NULL, $destination = NULL) {
  // Run error if someone tries to run config-import instead of
  // config-split-import.
  return drush_set_error(dt('Per policy.drush.inc, you should run drush csim instead of drush cim.'));
}

/**
 * Implementation of drush_hook_COMMAND_validate().
 */
function drush_policy_config_export_validate($source = NULL, $destination = NULL) {
  // Run error if someone tries to run config-import instead of
  // config-split-import.
  return drush_set_error(dt('Per policy.drush.inc, you should run drush csex instead of drush cex.'));
}

Create split directories:

mkdir -p config/dev
touch config/dev/.keep
mkdir -p config/stage
touch config/stage/.keep
mkdir -p config/prod
touch config/mkdir -p config/prod/.keep

In your settings.php update/set your config directory to:

$config_directories[CONFIG_SYNC_DIRECTORY] = '../config/sync';

On Your local or development server add the following to your settings.local.php or settings.dev.php file:

// Config split settings for development.
$config['config_split.config_split.production']['status'] = FALSE;
$config['config_split.config_split.staging']['status'] = FALSE;
$config['config_split.config_split.development']['status'] = TRUE;

If you are using Pantheon you can add the following to your settings.php file.

if (isset($_ENV['PANTHEON_ENVIRONMENT'])) {
  // Live Pantheon environment.
  if ($_ENV['PANTHEON_ENVIRONMENT'] == 'live') {
    $config['config_split.config_split.production']['status'] = TRUE;
    $config['config_split.config_split.development']['status'] = FALSE;
    $config['config_split.config_split.staging']['status'] = FALSE;
  }
  // Dev / Test / Multi Branch Pantheon environment.
  else {
    $config['config_split.config_split.production']['status'] = FALSE;
    $config['config_split.config_split.development']['status'] = FALSE;
    $config['config_split.config_split.staging']['status'] = TRUE;
  }
}
else {
  $config['config_split.config_split.production']['status'] = FALSE;
  $config['config_split.config_split.development']['status'] = TRUE;
  $config['config_split.config_split.staging']['status'] = FALSE;
}

If you are not on pantheon create/update settings.dev.php.

// Config split settings for development.
$config['config_split.config_split.production']['status'] = TRUE;
$config['config_split.config_split.staging']['status'] = FALSE;
$config['config_split.config_split.development']['status'] = FALSE;

If you are not on pantheon create/update settings.stage.php.

// Config split settings for staging.
$config['config_split.config_split.production']['status'] = FALSE;
$config['config_split.config_split.staging']['status'] = TRUE;
$config['config_split.config_split.development']['status'] = FALSE;

If you are not on pantheon create/update settings.prod.php.

// Config split settings for product.
$config['config_split.config_split.production']['status'] = TRUE;
$config['config_split.config_split.staging']['status'] = FALSE;
$config['config_split.config_split.development']['status'] = FALSE;

Then in your local.settings.php comment/uncomment basees on the environment:

@include('settings.dev.php');
# @include('settings.stage.php');
# @include('settings.prod.php');

Post-installation

This module is only meant as a starting point. Once installed you should uninstall the module.

drush pm-uninstall xeno_config_split
composer remove xenomedia/xeno_config_split

There may be cases that you don't need a staging and development split since they may be exactly the same. In that case you can just delete one of them.

How to use it

See Configuration Split for full documentation.

In short, update your settings.local.php for the environment you want to make changes to.

Example: Add a module so it is only installed on production

Update your settings.local.php so that only production is TRUE and the others are set to FALSE.

Run drush csim -y

Select the module in the Complete Split select.

Run drush csex -y

Example: Ignore Webform settings

Navigate to /admin/config/development/configuration/ignore

Add webform.webform.* to text area

Save Configuration

Run drush csex -y

xenomedia/xeno_config_split 适用场景与选型建议

xenomedia/xeno_config_split 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 606 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 04 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「configuration」 「drupal」 「configuration management」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 xenomedia/xeno_config_split 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 xenomedia/xeno_config_split 我们能提供哪些服务?
定制开发 / 二次开发

基于 xenomedia/xeno_config_split 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 606
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2018-04-25