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.

General Questions /

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

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

Director::set_dev_servers improvement


Reply


3 Posts   454 Views

Avatar
Josua

Community Member, 86 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
simon_w

Forum Moderator, 474 Posts

17 January 2012 at 10:13am

Have a look at using [url=http://doc.silverstripe.org/sapphire/en/topics/environment-management]_ss_environment.php[/url] for this.

Avatar
Josua

Community Member, 86 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.