Git、Kohana 和PHPFog工作流程
Kohana 3 包括环境常量,特别是生产、分期、测试和环境常量。开发(此处讨论)。
建议您在 .htaccess 文件中使用 SetEnv 设置这些常量(此处讨论)。
例如:
生产 .htaccess:
SetEnv KOHANA_ENV PRODUCTION
SetEnv BASE_URL http://www.domain.com
开发 .htaccess:
SetEnv KOHANA_ENV DEVELOPMENT
SetEnv BASE_URL http://127.0.0.1/domain/
我一直在寻找在 Git 中管理不同版本的 .htaccess 文件的方法。我查看了分支,但是 VonC 提交了 很好的答案,表明这可能不是最好的方法。
VonC 进一步建议 .gitattributes 过滤器驱动程序作为解决方案(Pro Git 解释)。
我喜欢使用 .gitattributes 过滤器驱动程序的想法,但我一直在努力寻找我能理解的“如何做”示例(Pro Git 示例比我高一点)。
我正在使用 PHPFog 进行部署。它们要求您执行克隆并推送来部署您的应用程序。
所以我的问题是:
- 这是在 Kohana 中设置环境变量的正确方法吗?
- 我可以将 .gitattributes 过滤器驱动程序与 PHPFog 一起使用吗?
- 如何创建过滤器以将环境变量添加到 .htaccess 文件?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据许多论坛, htaccess 中的 setenv 是完全可以接受的
--在 PHPFog 上,您可以在应用程序控制台中设置环境变量。
.gitattributes 不是请求的功能,也从未将其纳入 PHPFog
您可以使用 vi 或 vim 制作 htaccess 文件,又名:
<代码>
vim /.htaccess
然后使用
i
插入新数据,
使用
esc
退出,使用
:wq
保存并退出 vim
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 dataand
esc
to escape outand
:wq
to save and exit vim