Skip to content

Instantly share code, notes, and snippets.

@erikhansen
Last active November 15, 2016 16:20
Show Gist options
  • Save erikhansen/cfa278a80a6684bb7aa8d79ebcbf2f63 to your computer and use it in GitHub Desktop.
Save erikhansen/cfa278a80a6684bb7aa8d79ebcbf2f63 to your computer and use it in GitHub Desktop.
dev-web56 Gist - The purpose of this Gist is to provide a template Magento 2 env.php file to use within the davidalger/devenv environment. See usage instructions below: https://gist.github.com/erikhansen/cfa278a80a6684bb7aa8d79ebcbf2f63#gistcomment-1922462
<?php
return array (
'backend' =>
array (
'frontName' => 'backend',
),
'crypt' =>
array (
'key' => '<KEY>',
),
'install' =>
array (
'date' => '<DATE>',
),
'db' =>
array (
'connection' =>
array (
'default' =>
array (
'host' => 'dev-db',
'dbname' => '<DBNAME>',
'username' => 'root',
'password' => '',
'model' => 'mysql4',
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
),
// Only relevant for Magento EE
'indexer' =>
array (
'host' => 'dev-db',
'dbname' => '<DBNAME>',
'username' => 'root',
'password' => '',
'model' => 'mysql4',
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'persistent' => NULL,
),
),
'table_prefix' => '',
),
'cache' =>
array (
'frontend' =>
array (
'default' =>
array (
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' =>
array (
'server' => 'dev-web56',
'port' => '6379',
'persistent' => '',
'database' => '0',
'force_standalone' => '0',
'connect_retries' => '1',
'read_timeout' => '10',
'automatic_cleaning_factor' => '0',
'compress_data' => '1',
'compress_tags' => '1',
'compress_threshold' => '20480',
'compression_lib' => 'gzip',
),
),
'page_cache' =>
array (
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' =>
array (
'server' => 'dev-web56',
'port' => '6379',
'persistent' => '',
'database' => '1',
'force_standalone' => '0',
'connect_retries' => '1',
'read_timeout' => '10',
'automatic_cleaning_factor' => '0',
'compress_data' => '0',
'compress_tags' => '1',
'compress_threshold' => '20480',
'compression_lib' => 'gzip',
),
),
),
),
'session' =>
array (
'save' => 'files',
),
'resource' =>
array (
'default_setup' =>
array (
'connection' => 'default',
),
),
'x-frame-options' => 'SAMEORIGIN',
'MAGE_MODE' => 'development',
'cache_types' =>
array (
'config' => 1,
'layout' => 1,
'block_html' => 1,
'collections' => 1,
'reflection' => 1,
'db_ddl' => 1,
'eav' => 1,
'full_page' => 1,
'config_integration' => 1,
'config_integration_api' => 1,
'target_rule' => 1,
'translate' => 1,
'config_webservice' => 1,
),
// Only relevant for Magento EE
'queue' =>
array (
'amqp' =>
array (
'host' => '',
'port' => '',
'user' => '',
'password' => '',
'virtualhost' => '/',
'ssl' => '',
),
),
);
@erikhansen
Copy link
Author

Using this GIST allows you to copy a standard env.php file to your environment with a randomly generated encryption key and the install date set as the current date.

Example usage for web56 VM:

export DBNAME=example_mage_dev
export ENVPATH=/server/sites/example.dev/app/etc/env.php
curl -s https://gist.githubusercontent.com/erikhansen/cfa278a80a6684bb7aa8d79ebcbf2f63/raw | \
    sed "s/<KEY>/$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)/" | \
    sed "s/<DATE>/$(date +'%a, %d %b %Y %H:%M:%S %z')/" | \
    sed "s/<DBNAME>/$DBNAME/" > \
    $ENVPATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment