有没有一种模块可以告诉您是否已登录开发,阶段或生产


13

我们的部署模型有

  1. 开发人员
  2. 阶段
  3. 生产
  4. 故障转移(mysql复制和负载平衡器)

我们的问题是服务器已经进行了故障转移,我们想提醒内容编辑器它们正在进行故障转移,或者更进一步,我们想确保它们在生产区域而不是在开发区域进行编辑。

用户登录后,是否可以区分环境?是否有模块根据服务器的主机名对管理栏进行颜色编码?

Answers:


14

尝试使用Environment Indicator,它正是您想要的。

通过向每个环境添加可配置的颜色栏,该模块将帮助您在不同环境下工作时保持理智。

它还与“管理菜单”很好地集成。


7

如第一个答案所述, environment_indicator是您要寻找的环境。

好吧,我们还使用相同类型的开发模型,并且如果使用功能模块,则为了易于使用,您可以将设置写入文件中。这使颜色更改自动化。

请遵循以下代码,可以通过“功能”模块将其导入。

/**
 * Implements hook_default_environment_indicator_environment().
 */
function mymodule_default_environment_indicator_environment() {
  $export = array();

  $environment = new stdClass();
  $environment->disabled = FALSE; /* Edit this to true to make a default environment disabled initially */
  $environment->api_version = 1;
  $environment->machine = 'live';
  $environment->name = 'Live';
  $environment->regexurl = 'example.com';
  $environment->settings = array(
    'color' => '#bb0000',
    'text_color' => '#ffffff',
    'weight' => '',
    'position' => 'top',
    'fixed' => 0,
  );
  $export['live'] = $environment;

  $environment = new stdClass();
  $environment->disabled = FALSE; /* Edit this to true to make a default environment disabled initially */
  $environment->api_version = 1;
  $environment->machine = 'staging';
  $environment->name = 'Staging';
  $environment->regexurl = 'stage.example.com';
  $environment->settings = array(
    'color' => '#000099',
    'text_color' => '#ffffff',
    'weight' => '',
    'position' => 'top',
    'fixed' => 0,
  );
  $export['staging'] = $environment;

  $environment = new stdClass();
  $environment->disabled = FALSE; /* Edit this to true to make a default environment disabled initially */
  $environment->api_version = 1;
  $environment->machine = 'dev';
  $environment->name = 'Dev';
  $environment->regexurl = 'dev.example.com';
  $environment->settings = array(
    'color' => '#000066',
    'text_color' => '#ffffff',
    'weight' => '',
    'position' => 'top',
    'fixed' => 0,
  );
  $export['dev'] = $environment;

  return $export;
}

选择了模块答案,但仍对此表示赞成。非常感谢。
里克
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.