0

Kohana 3 includes environment constants, specifically PRODUCTION, STAGING, TESTING & DEVELOPMENT (discussion here).

It's been suggested that you set those constants using SetEnv in your .htaccess file (discussion here).

For Example:

PRODUCTION .htaccess:

SetEnv KOHANA_ENV PRODUCTION
SetEnv BASE_URL http://www.domain.com

DEVELOPMENT .htaccess:

SetEnv KOHANA_ENV DEVELOPMENT
SetEnv BASE_URL http://127.0.0.1/domain/

I've been looking for ways to manage the different version of the .htaccess file in Git. I looked at branching, but VonC submitted a great answer, suggesting it might not be the best approach.

VonC further suggested .gitattributes filter driver as a solution (Pro Git explanation).

I like the idea of using the .gitattributes filter driver, but I've struggled to find "how to" examples that I can understand (the Pro Git examples were a little above me).

I'm using PHPFog to deploy. They require you to do clone and push to deploy your application.

So here are my questions:

  • Is this the right approach for setting environment variables in Kohana?
  • Can I use the .gitattributes filter driver with PHPFog?
  • How do I create the filter to add the environment variables to the .htaccess file?
Community
  • 1
  • 1
timborden
  • 1,470
  • 4
  • 18
  • 24
  • I've posted the same question to the Kohana community here: http://forum.kohanaframework.org/discussion/8582/git-kohana-phpfog-workflow – timborden Mar 28 '11 at 20:44
  • 2
    Just FYI, PHP Fog introduced environment variables to the App Console not long ago so you can set the variables from the console now. – Skierkowski May 15 '11 at 00:13

1 Answers1

1

According to many forums out there setenv in htaccess is perfectly acceptable --On PHPFog you can set environmental variables in the app console.

.gitattributes were not a requested feature and never made it into PHPFog

You can make the htaccess file using vi or vim aka:
vim /.htaccess

then use i to insert new data

and

esc to escape out

and

:wq

to save and exit vim

Rich H.
  • 154
  • 2