1

Is it possible to have a dev version path for the Element API plugin so we can keep live and dev API separated?

2

Craft config files usually allow to return environment-specific arrays. So you could just configure different endpoints like so:

return [
    '*' => [],
    '.com' => [
        'endpoints' => [
            'api/example<ext:(.json)?>' => function() {
                // example API config for live environment
            },
        ],
    ],
    '.dev' => [
        'endpoints' => [
            'api/example<ext:(.json)?>' => function() {
                // example API config for dev environment
            },
        ],
    ],
];
1

Doh so the answer is PHP constants:

define('CRAFT_CONFIG_PATH', '../../craftdev/config/');

useful to know.

1
  • 1
    That'll change the path for all your config files (including db.php, general.php and Redactor configs), though. – Mats Mikkel Rummelhoff Dec 15 '16 at 9:17

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.