Yii Framework Forum: Split Config For Console App - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Split Config For Console App Rate Topic: -----

#1 User is offline   _axl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 21-January 13

Posted 21 January 2013 - 08:53 AM

I want to divide my config files for local and remote servers. I ve done this for main config but now i realized that i cant detect if console app is executing on local server. So how to do it? Thanks for all.
0

#2 User is offline   lubosdz 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 115
  • Joined: 25-July 10
  • Location:Slovakia, Bratislava

Posted 21 January 2013 - 09:05 AM

If you try to search, there has been lots of solutions suggested - you may choose, which suits u best:

http://www.yiiframew...ironment-class/

http://www.yiiframew...making-changes/

http://www.yiiframew...ifferent-modes/

http://www.yiiframew...ironment-class/

Cheers
Yii extension: Captcha Extended

Greatest discoveries in 22nd century will be about the gravitation. | http://www.synet.sk | http://ipdf.sk
0

#3 User is offline   _axl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 21-January 13

Posted 21 January 2013 - 10:34 AM

Thank for answer, but i already found solution for split configs.
My question is little particular, im asking only: if application was started from console how to detect, that it running on local server?
For example, if app was run from web i can check:
if($_SERVER['SERVER_ADDR'] == '127.0.0.1'){
//include local config
}

But it doesnt work in console app.

I created copy of main config, with parameters wich will work only on localhost, and now i need to do this with console config.
0

#4 User is offline   rootbear 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 17-June 11

Posted 21 January 2013 - 10:52 AM

split the local and production config files for console app as you did for web app;
instead trying to detect in your console app if it's running from local or production, you tell console app where you run it from via constant flag
I enjoy the Yii.sy coding life here.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users