webgriffe/module-config-override 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

webgriffe/module-config-override

Composer 安装命令:

composer require webgriffe/module-config-override

包简介

A Magento 2 module that reads from file additional configuration

README 文档

README

⚠️DEPRECATION⚠️

This module it is now useless, you can:

  1. Do composer require symfony/dotenv, take a look to these exaplanations to see the hierarchy;
  2. Create the file app/etc/EnvironmentVariablesLoader.php
<?php

declare(strict_types=1);

use Symfony\Component\Dotenv\Dotenv;

(new Dotenv())->loadEnv(__DIR__ . "/../../.env");
  1. Load it throught composer modifing the composer.json file:
    "files": [
+     "app/etc/EnvironmentVariablesLoader.php",
      "app/etc/NonComposerComponentRegistration.php"
    ],
  1. Create the env files configuring variables as written on the magento docu.

⚠️DEPRECATION⚠️

Build Status

A Magento 2 module that overrides default configuration from file which can be added to version control, inspired by this Magento 1.x extension: https://github.com/webgriffe/config-extension.

Installation

Add this extension as dependency using Composer:

composer require webgriffe/module-config-override
php bin/magento setup:upgrade

Config override

Magento configuration is driven by database. This, sometimes, is overkill and forces us to maintain upgrade script to keep Magento envorinment aligned with features development. So, this extension enables additional config source that loads several YAML files and overrides database configuration.

Loaded YAML files are (in this order):

  • app/etc/default.yml.dist: this intended to be under version control to distribute configuration for all environments.
  • app/etc/default.yml: this is intendet to be ignored by version control system to provide configuration related to local needs.

Also, if the MAGE_ENVIRONMENT environment variable is defined, then two additiontal files are loaded. For example, if the MAGE_ENVIRONMENT variable value is dev, the following two files are loaded:

  • app/etc/default-dev.yml.dist: as default.yml.dist, this is intended to be under version control to distribute configuration but only for the dev environment.
  • app/etc/default-dev.yml: as default.yml, this is intended to be ignored by version control to provide configuration related to local needs but only for the dev environment.

Configuration in YAML files must be specified with the same structure of Magento system configuration, for example:

web:
  secure:
    base_url: "http://my-project-url.dev/"
  unsecure:
    base_url: "http://my-project-url.dev/"

Only default configuration scope is overridden.

CLI notes

Please note that if you use the MAGE_ENVIRONMENT variable then it should be always set when Magento is running. So is not enough to set it through your webserver (for example with a SetEnv "dev" in Apache) but it should also be set into your command line shell. Otherwise, if you have the Magento's configuration cache enabled and you clear the cache from the command line, the MAGE_ENVIRONMENT will not be applied and you'll get unexpected behaviours.

Remember to "export" you env variable when you run a command via shell:

export MAGE_ENVIRONMENT=dev && <your command> 

alternative you can add the MAGE_ENVIRONMENT=dev in your shell configuration (ex. for bash):

file /home/<you user>/.bashrc:

....
....

MAGE_ENVIRONMENT=dev

Overridden config values are shown in backend

Overridden config values are shown in Magento's backend. Every config setting it's shown on its section. For example, if you have the following default.yml file:

design:
  head:
    default_title: Webgriffe Store
    title_suffix: - Webgriffe Store

When you'll go to Stores -> Configuration -> General -> Design you'll find the overridden config value shown and not editable.

Admin Screenshop

This feature improves a lot the usability of this extension.

To Do

  • Improve system config admin interface to support complex fields

Credits

webgriffe/module-config-override 适用场景与选型建议

webgriffe/module-config-override 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.98k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2017 年 05 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 webgriffe/module-config-override 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 3.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 21
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 21
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-03