Skip to content

Commit

Permalink
Add config_split for more complicated env configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
miromichalicka committed Sep 16, 2017
1 parent 61f496f commit 57184a1
Show file tree
Hide file tree
Showing 18 changed files with 306 additions and 21 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"drupal/migrate_source_yaml": "dev-custom",
"drupal/mathjax": "^2.6",
"drupal/google_analytics_counter": "dev-8.x-3.x",
"drupal/captcha": "^1.0@beta"
"drupal/captcha": "^1.0@beta",
"drupal/config_split": "^1.1"
},
"require-dev": {
"behat/mink": "~1.7",
Expand Down
138 changes: 137 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions config/dev/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions config/prod/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
2 changes: 2 additions & 0 deletions config/prod/beliana_sync.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
remote_url: 'https://rs.beliana.sav.sk/'
langcode: sk
16 changes: 16 additions & 0 deletions config/prod/locale.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cache_strings: true
translate_english: false
javascript:
directory: languages
translation:
use_source: remote_and_local
default_filename: '%project-%version.%language.po'
default_server_pattern: 'http://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po'
overwrite_customized: false
overwrite_not_customized: true
update_interval_days: 0
path: sites/prod/files/translations
import_enabled: true
_core:
default_config_hash: Lqw8pAQIfr4sRSts2RRWG97eNG6vRT7FhqF_b5COPGk
langcode: sk
23 changes: 23 additions & 0 deletions config/stage/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
2 changes: 2 additions & 0 deletions config/stage/beliana_sync.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
remote_url: 'https://dev.beliana.sav.sk/'
langcode: sk
16 changes: 16 additions & 0 deletions config/stage/locale.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cache_strings: true
translate_english: false
javascript:
directory: languages
translation:
use_source: remote_and_local
default_filename: '%project-%version.%language.po'
default_server_pattern: 'http://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po'
overwrite_customized: false
overwrite_not_customized: true
update_interval_days: 0
path: sites/stage/files/translations
import_enabled: true
_core:
default_config_hash: Lqw8pAQIfr4sRSts2RRWG97eNG6vRT7FhqF_b5COPGk
langcode: sk
16 changes: 16 additions & 0 deletions config/sync/config_split.config_split.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
uuid: 033e25ad-5fc3-40ed-9f1a-ba79c1a66d13
langcode: sk
status: false
dependencies: { }
id: dev
label: Dev
folder: ../config/dev
module: { }
theme: { }
blacklist:
- beliana_sync.config
- locale.settings
graylist: { }
graylist_dependents: true
graylist_skip_equal: true
weight: 0
16 changes: 16 additions & 0 deletions config/sync/config_split.config_split.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
uuid: 30d5eaea-ace2-40ac-95b1-2a3da5f4d247
langcode: sk
status: true
dependencies: { }
id: prod
label: Prod
folder: ../config/prod
module: { }
theme: { }
blacklist:
- beliana_sync.config
- locale.settings
graylist: { }
graylist_dependents: true
graylist_skip_equal: true
weight: 0
16 changes: 16 additions & 0 deletions config/sync/config_split.config_split.stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
uuid: ef9a26c8-d064-4f92-a386-c7946d48d5d3
langcode: sk
status: true
dependencies: { }
id: stage
label: Stage
folder: ../config/stage
module: { }
theme: { }
blacklist:
- beliana_sync.config
- locale.settings
graylist: { }
graylist_dependents: true
graylist_skip_equal: true
weight: 0
2 changes: 2 additions & 0 deletions config/sync/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module:
colorbox: 0
comment: 0
config: 0
config_filter: 0
config_split: 0
ctools: 0
datetime: 0
dblog: 0
Expand Down
4 changes: 4 additions & 0 deletions web/sites/dev/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
$config['system.performance']['css']['preprocess'] = 0;
// Aggregate JavaScript files on
$config['system.performance']['js']['preprocess'] = 0;
// Configure config split.
$config['config_split.config_split.dev']['status'] = TRUE;
$config['config_split.config_split.stage']['status'] = FALSE;
$config['config_split.config_split.prod']['status'] = FALSE;

$settings['hash_salt'] = 'J2RATdd4h4GdghkCZH99vaNPXR2-6_q0m6fC1qlrYm6SzkpAp48cDboGnEC6iQy940JhA9rzcA';
$settings['install_profile'] = 'standard';
Expand Down
18 changes: 4 additions & 14 deletions web/sites/prod/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
* Settings for staging environment. Same will be used for production.
*/

// Don't show any error messages on the site (will still be shown in watchdog).
$config['system.logging']['error_level'] = 'hide';
// Expiration of cached pages on Varnish to 15 min.
$config['system.performance']['cache']['page']['max_age'] = 900;
// Aggregate CSS files on.
$config['system.performance']['css']['preprocess'] = 1;
// Aggregate JavaScript files on.
$config['system.performance']['js']['preprocess'] = 1;

$settings['hash_salt'] = 'J2RATdd4h4GdghkCZH99vaNPXR2-6_q0m6fC1qlrYm6SzkpAp48cDboGnEC6iQy940JhA9rzcA';
$settings['install_profile'] = 'standard';
$config_directories['sync'] = '../config/sync';
Expand All @@ -29,11 +20,10 @@
$config['search_api.server.solr']['backend_config']['connector_config']['http']['http_pass'] = '';
$config['search_api.server.solr']['name'] = 'Solr - Environment: prod';

// Locale settings.
$config['locale.settings']['translation']['path'] = 'sites/stage/files/translations';

// Beliana settings.
$config['beliana_sync.config']['remote_url'] = 'http://rs.beliana.sav.sk/';
// Configure config split.
$config['config_split.config_split.dev']['status'] = FALSE;
$config['config_split.config_split.stage']['status'] = FALSE;
$config['config_split.config_split.prod']['status'] = TRUE;

// Last: this servers specific settings files.
if (file_exists(__DIR__ . '/settings.local.php')) {
Expand Down
Loading

0 comments on commit 57184a1

Please sign in to comment.