0

I'm having a weird issue trying to figure out which database my staging site (staging.domain.com) is connecting too. On my staging site, craft is up-to-date, but does not show the latest changes I made (added a new section and updated craft), which makes me think it's using the live database. However, if it's using the live DB, it should show craft as needing updates? All the other changes on the staging site are working fine (ie. tmpl & css updates).

So to troubleshoot, I added devMode to my staging site array to see if my keys were working properly. This added the devMode strip to the top of the CP. Next, I double checked both database on the server to make sure they were different. The staging DB has the new section I just added. Lastly, I cleared the cache to see if that made a difference.

Am I totally missing something here?

general.php:

return array(
    '*' => array(
        'cpTrigger' => 'cp-admin',
        'omitScriptNameInUrls' => true,
        'environmentVariables' => array(
            'basePath' => $base_path,
            'baseUrl'  => $base_url
        )
    ),
    '.dev' => array(
        'devMode' => true,
    ),
    'stage.' => array(
        'devMode' => true,
    ),
    '.com' => array(
        'cooldownDuration' => 0,
    )
);

db.php:

return array(

    '*' => array(
        'tablePrefix' => 'craft',
    ),

    '.dev' => array(
        'server' => 'localhost',
        'user' => 'root',
        'password' => 'root',
        'database' => '***pa_craft',
    ),

    'stage.' => array(
        'server' => 'localhost',
        'user' => '***pa',
        'password' => '***',
        'database' => '***pa_craft',
    ),

    '.com' => array(
        'server' => 'localhost',
        'user' => '***pa',
        'password' => '***',
        'database' => '***pa_craft_live',
    ),

);

Update

I just switched my local setup (dev) to point to the remote staging DB which connects and shows the updates. I also added a new entry to check to see if was writing to the correct DB.

2

If your domain name is actually staging.somedomain.com and your multi-environment config is searching for stage., then they won't match up.

What will match, however, is the .com key directly underneath it, which is probably what you're thinking is only for the live site.

Being more explicit with your matching multi-environment config keys will probably clear up the confusion.

  • Thanks Brad. I ended up having to be explicit both the staging (stage.domain.com) & live domain (www.domain.com). I thought a partial match would return true for the first match in the array. (ie. the staging key above the live key) – Siebird Oct 29 '14 at 14:37
  • Even so, there was no partial match. stage does not match staging. – Brad Bell Oct 29 '14 at 14:42
  • There should have been a match as the actual subdomain is stage.domain.com, so stage. should return true. It did for the general.php as it added the devMode strip, thus all the confusion – Siebird Oct 29 '14 at 14:50
  • Ahh... the original post said staging, so I was confused. – Brad Bell Oct 29 '14 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.