focuslabllc / ee-master-config Goto Github PK
View Code? Open in Web Editor NEWFocus Lab's Master Config setup for quick ExpressionEngine multi-environment support
Home Page: http://focuslabllc.com/ee
Focus Lab's Master Config setup for quick ExpressionEngine multi-environment support
Home Page: http://focuslabllc.com/ee
I haven't contributed to any git issues before, please bear with me if I'm doing this in the wrong area or formatting my question incorrectly. I don't know if this even qualifies as an issue either.
I'm setting up a new project using EE 2.9.3 and making use of FocusLab's Master Config. I'm noticing (for the first time) when you do an install, EE offers the option to use MySQLi or MySQL - defaulting to MySQLi. And if you take a look at the Master Config database.php file there's a var for dbdriver, it's default value is "MySQL". I'm assuming that I should just use the same value that EE had created when I performed the EE install "mysqli", which I"m guessing should just work and shouldn't be an issue at all.
In the future will Master Config default to MySQLi as the dbdriver value? I'm no expert in this area, but before making any choice during the EE install, I had to do some research to become familiar with what MySQLi was anyway. Based on the docs I was reading, the impression I've got is MySQLi is the preferred way to go as long as your server's using php5... again, not an expert, just wanting to contribute to things overall.
Hope this is helpful in some way.
Reuben
I'm messing around with MSM and I have a question about the order config files are loaded in. Is this correct?:
index.php
or admin.php
/system/expressionengine/config.php
/system/expressionengien/database.php
/config/config.master.php
/config/config.env.php
/config/config.local.php
)I'm also confused about when/how config.env.php
gets loaded. The only reference I see for it is in config.master.php
at line 36, but the comments & code imply that the environment should already have been defined. If that's the case - where is the environment defined?
I believe that emoticon path should use $images_path on line 107 of master config.
Hello,
I set up my master config files on my local computer and it worked fine. However as soon as i move the site to the dev folder, i keep getting the following error
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/EE_Config.php
Line Number: 207
I can't seem to figure out what might be wrong. I tried using the exit(ENV);
in my config.env.php
file, but it does not seem to be having any effect i can see.
Any ideas on how i can see what is really causing the error? I have tried access the database using the supplied credentials and they work. So i am thinking it might be a path issue or a wrong environment is being picked.
HI. I have a site implementing your very cool config master. Do you have any experience upgrading from EE2 to EE3 with this in place? The Ellis Lab core upgrade instructions assume a default config. Thanks!
I've been trying to set some variables on a per-environment basis inside Master Config, but I keep getting browser errors. For example, if I put this at the bottom of config.local.php
:
if ($site_id == '1') {
$env_config['webmaster_email'] = '[email protected]';
} else {
$env_config['webmaster_email'] = '[email protected]';
}
I get a browser "can't load this page" error.
What am I doing wrong here?
I am using this config file to streamline my dev, staging, and production deployments, but I am having one issue that I can't quite figure out.
My Entry Notification Email is as follows:
A new entry has been posted in the following channel:
{channel_name}
The title of the entry is:
{entry_title}
Posted by: {name}
Email: {email}
To read the entry please visit:
{entry_url}
Problem is: the entry_url is not updating across deployments, while everything else under the sun is.
In other words, dev.example.com is where the entry was created, after migrating to staging, the email template still displays dev.example.com rather than staging.example.com.
Any ideas?
I'm trying to give the is_site_on setting the same treatment as the debug preference.
So far, in config.master.php I have added;
$env_config['is_system_on'] = (ENV_SYSTEM_ON) ? 'y' : 'n' ;
Then within config.env.php, in the appropriate CASE I have;
define('ENV_SYSTEM_ON', FALSE);
However the setting I make in config.env.php seems to be ignored and the only way to turn the site on or off is to do so within the CP.
Do you have any idea why this may be and how I could overcome it so I could set the on/off status within my environment cases?
Hello,
would it be possible to have the site_name variable available in the config file for a msm setup?
I've set the upload paths in the config file, but I'd like the images in a separate site folder
eg.
$assign_to_config['upload_preferences'] = array( 1 => array( 'name' => 'Static imagessss', 'server_path' => '/Users/username/Documents/workspace/site/assets/uploads/site_default/images/static/', 'url' => 'http://site.localhost/assets/uploads/'. $config["site_name"] .'/images/static/' ), 3 => array( 'name' => 'Sponsor images', 'server_path' => '/Users/username/Documents/workspace/site/assets/uploads/site_default/images/sponsor/', 'url' => 'http://site.localhost/assets/uploads/'. $config["site_name"] .'/images/sponsor/' ) );
I've already tried several things... but no solution so far.
Any insights are welcome ;-)
kind regards,
Vic
Hey Erik,
This isn't so much an issue as a (hopefully) small request. I've been using this for several sites, but I'm getting ready to use it for a site that uses MSM. I'm not 100% sure how to go about doing that and would love to see an example when you get a chance.
Thanks!
.angie
We've been getting this issue intermittently after each new deployment (using springloops.io for git to ftp). I can't seem to pinpoint exactly what the issue is, it doesn't seem to be url specific as I get the same error no matter what urls I visit, including admin.php. The error:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/EE_Config.php
Line Number: 207
And .htaccess just in case:
<IfModule mod_rewrite.c>
RewriteEngine On
# Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
Any clues to how I can troubleshoot?
Hello,
In a stock install of EE running on my local Mac's Apache, I've done the following:
When I try to run it, I get the following error:
Fatal error: Call to undefined method CI_Config::site_prefs() in /Users/username/Sites/projects/sitename.local/system/expressionengine/libraries/Core.php on line 122
Any way you can help with this?
Thanks,
Jonathan
I'm curious if the ee-master-config works for EE5? Has anyone tried? Thanks!
Hopefully
Hi! Hopefully you can help me with a particular request.
I would like to move the third-party modules folder out of the webroot for maintainance sake. I would like to manage them as git submodules. How do you deal at FocusLab with the themes though? Do you use symlinks?
The link to:
http://alexball.tv/blog/using-focus-labs-master-config-in-webroot/
Is no longer working. Found a copy here:
From https://github.com/focuslabllc/ee-master-config
"However, if you’re unable to do this due to hosting restraints Alex Ball has written about the changes necessary to support this. You can read his step-by-step here."
This link however is now dead - anywhere else I can find this info?
Hello,
I just noticed that the $env_config['cp_url'] variables gets an extra slash. This is in config.master.php, around like 105. See:
$env_config['base_url'] = $base_url . '/';
$env_config['site_url'] = $env_config['base_url'];
$env_config['cp_url'] = $env_config['base_url'] . '/admin.php';
It's safe to remove the slash that appears before admin.php, yes?
Guys,
Minor issue, but I think you forgot the '%' in your check for daylight savings. Line 217 in config.master.php:
$env_config['daylight_savings'] = date('I') ? 'y' : 'n'; // Autodetect DST
Should be this:
$env_config['daylight_savings'] = date('%I') ? 'y' : 'n'; // Autodetect DST
Added the '%' to date('**%**I)
Thanks.
Dan
Hi,
Are you planning an EE3 version?
I am getting the following error messages when trying to install on /admin.php:
We have detected that you are currently running ExpressionEngine version Public Beta pb01
If you are ready to update ExpressionEngine to version 2.5.0 click the link below:
Click here to update ExpressionEngine to Version 2.5.0
This is on EE 2.5.0.
I would like to set my images to use relative paths so that for each image it is not having to resolve the domain lookup. I'm trying to configure my site to load as fast as possible.
How can I set images to use relative paths?
When going to the site natirar.com -
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/EE_Config.php
Line Number: 180
^ this appears
When attempting to login to the back end of the site, it does not allow me to either
After setting up custom upload directory paths in /config/config.master.php, some add-ons that use file paths have been breaking.
With Pixel & Tonic's Assets v1.2.2, the image preview thumbnails appear broken in the browser pane. When I right-click on a preview image and choose "view file", the URL it opens looks like this:
http://www.mysite.com/?ACT=33&file=%7Bfiledir_1%7Dmy-image.png
With Solspace Freeform 4.0.6, for a form with a file upload field, if I select "Include Attachment" in a notification template, the resulting email will be blank.
Images and files all display correctly on the front-end when used in templates. Commenting out the upload directory configurations in config.master.php fixes both problems.
Here is an example of my upload directory configuration in /config/config.master.php:
$env_config['upload_preferences'] = array(
1 => array(
'name' => 'Main Upload Directory',
'server_path' => $images_path . '/uploads/main',
'url' => $images_path . '/uploads/main/'
),
2 => array(
'name' => 'Portfolio',
'server_path' => $images_path . '/uploads/portfolio',
'url' => $images_url . '/uploads/portfolio/'
),
3 => array(
'name' => 'WYSIWYG Uploads',
'server_path' => $images_path . '/uploads/wysiwyg',
'url' => $images_url . '/uploads/wysiwyg/'
)
);
I have experienced these problems in EE 2.5.2 and 2.5.3 with Master Config 1.1.1.
Hey Erik,
I think the line 107 of config.master.php should read as;
$env_config['emoticon_path'] = $images_path . '/smileys/';
instead of;
$env_config['emoticon_path'] = $images_url . '/smileys/';
Hi,
don't know if I'm doing anything wrong... but here's the situation:
I want to fetch the templates from the database in production.
So I uncomment the following line:
$env_config['save_tmpl_files'] = (ENV == 'prod') ? 'n' : 'y';
But then in EE, I can't synchronize my templates and get the following message:
Saving templates as text files is not currently enabled in global template preferences.
I'm pretty sure I'm in the 'prod' environment, otherwise I would not be able to connect to the database.
Happened before? Any ideas?
kind regards,
Vic
Thanks for the great addition to the EE community!
I'm having an issue when I try to force trailing slashes using some .htaccess rules. When I add the appropriate rules I get an error of:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/EE_Config.php
Line Number: 211
The error only occurs when I try to access a URL that doesn't have a trailing slash. When I do that I get redirected to appropriate URL (with a trailing slash) but on port 7080. Example:
If I try to access:
http://mydomain.com/something/else
I get redirected to:
http://mydomain.com:7080/something/else/
And then the database error is shown.
Here are the .htaccess rules I'm using for removing the trailing slashes:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]
If I remove those 3 lines everything works fine.
Also, I'm currently working on the site using dedicated IP address instead of the final domain name. So that might have something to do with it, but I'm not entirely sure.
Have you encountered this before?
I'm having trouble with getting the .htaccess correct when using multi-config in a subdirectory. Here's my directory set up:
/config
/config_site2
/public_html
-.htaccess
-/site2
--.htaccess
/system
/system_site2
I have two multi-config files in two directories above the root (/config and /config_site2) along with two system folders (/system and /sytem_site2).
In the /public_html folder, I have the subdirectory (/public_html/site2) that's correctly rendering site2.
I'm consistently getting 500 server error, however. Here's the .htaccess file for site2:
#------------------- remove trailing slash -------------------
RewriteCond %{REQUEST_URI} !^/system_site2 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/$ /$1$2 [R=301,L,QSA]
#------------------- index.php -------------------
#strip index.php from the URL if that is all that is given
RewriteCond %{REQUEST_URI} !^/site2/system_site2
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)index.php\ HTTP/
RewriteRule ^(([^/]+/))index.php$ https://%{HTTP_HOST}/site2/ [R=301,NS,L,QSA]
#strip index.php/* from the URL
RewriteCond %{THE_REQUEST} ^[^/]/site2/index.php/ [NC]
RewriteRule ^index.php/(.+) https://%{HTTP_HOST}/$1$2 [R=301,L,QSA]
#------------------- CE Cache Static Driver -------------------
RewriteCond %{REQUEST_URI} !^/system_site2 [NC]
RewriteCond %{QUERY_STRING} !ACT|URL [NC]
RewriteCond %{REQUEST_METHOD} !=POST [NC]
RewriteCond %{DOCUMENT_ROOT}/static/ce_cache/190328/static%{REQUEST_URI}/index.html -f
RewriteRule (.) /_static_cache_handler.php%{REQUEST_URI}/index.html [L,QSA]
#------------------- EE -------------------
#rewrite all non-image/js/css urls back to index.php if they are not files or directories
RewriteCond $1 !.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site2/index.php/$1 [L,QSA]
What am I overlooking? Thanks much in advance!
In config.master.php, at the top and in the database section, you reference the ENV config files with no path:
require 'config.' . ENV . '.php';
But, in the config section, you use a full path:
require $_SERVER['DOCUMENT_ROOT'] . '/../config/config.' . ENV . '.php';
I just wanted to double-check: did you find that you needed to use the full path there? Or, should the pathless version always work. (Swapping that out with a pathless reference works fine for me.)
Hello everybody,
are there any ambitions to create an EE4 branch? Over the weekend I have tried the EE3 code with a fresh install of EE4.0 but it did not work. At least not in my case and not out of the box. Whilst having installed the focuslab ee-master-config on a couple of sites I couldn't say what exactly wasn't working, so any information or exchange with others would be great!
Thanks
Could you indicate in the readme whether or not this is EE 2.6 compatible?
Shouldn't line 62 in config.master.php be
$system_folder = SYSPATH . '../';
rather than
$system_folder = APPPATH . '../';
?
Hey guys,
I'm noticing that when I export my database from staging and import it on local, my URL to root directory is using the value form the environment I imported the database from for things like the "View Page" link on Structure pages. However, when I go to Admin -> General Configuration, all of the path and url fields are populated with the correct values. Simply clicking submit on that page fixes the issue.
Any idea if this is related to the master config file somehow?
I'm using EE 2.8.
When setting up the file uploads path, on windows, it needs backslashes vs forward slashes.
Note this bug report: http://expressionengine.com/bug_tracker/bug/17593
I'm going to try and come up with a solution though, maybe you have an idea already to conditionally check for Unix vs Windows and set the paths accordingly?
I have master config successfully working on EE3 with MSM, but cannot figure how to customize config overrides per site for things like theme path and them url, file upload directories, etc.
I'd rather not have this info stored in the db for each site as it's a hassle for local to remote database imports.
I have $env_globals['global:basepath'] = 'http://xxxxxx.com/';
in config.local.php but in my templates, I get {global:basepath}
output instead of the value.
This is under a MAMP set-up on my Mac. Everything else works fine. Is there something else I'm missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.