Jump to:

23576 Posts in 19403 Topics by 2893 members

General Questions

SilverStripe Forums » General Questions » Director::set_dev_servers improvement

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

Page: 1
Go to End
Author Topic: 417 Views
  • Josua
    Avatar
    Community Member
    86 Posts

    Director::set_dev_servers improvement Link to this post

    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.

  • simon_w
    Avatar
    Forum Moderator
    474 Posts

    Re: Director::set_dev_servers improvement Link to this post

    Have a look at using _ss_environment.php for this.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: Director::set_dev_servers improvement Link to this post

    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.

    417 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.