Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Director::set_dev_servers improvement


Go to End


3 Posts   815 Views

Avatar
Josua

Community Member, 87 Posts

17 January 2012 at 9:46am

Hi!

isDev use $_SERVER['HTTP_HOST'] for checking $dev_servers.
I think he should also use $_SERVER[REMOTE_ADDR], right?
In this way, we could use a remote address to work in development mode. :)

Regards,
Jose A.

Avatar
(deleted)

Community Member, 473 Posts

17 January 2012 at 10:13am

Have a look at using _ss_environment.php for this.

Avatar
Josua

Community Member, 87 Posts

19 January 2012 at 9:47am

Thanks Simon,

Indeed, we can do something like this (_config.php):
if(isset($_SERVER['REMOTE_ADDR']) && ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' || ($_SERVER['REMOTE_ADDR'] == '<my_ip>'))) {
Director::set_environment_type('dev');
} else {
Director::set_environment_type('live');
}

but, no bad thing that isDev also take into account $_SERVER['REMOTE_ADDR'].

Thank you very much Simon.

Regards,
Jose A.