Google App Engine Java中的环境特定变量 [英] Environment Specific Variables In Google App Engine Java

查看:104
本文介绍了Google App Engine Java中的环境特定变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为Java Google App Engine存储环境特定变量的最佳方法是什么?现在我正在将属性文件中的url或索引名称的不同值存储起来。我只是不停地紧张,我会忘记在下次部署时将用于本地计算机的值更改为生产。



有什么我们可以在应用程序引擎中设置的对于我们的应用程序来说,当它运行在应用程序引擎上时,以及本地文件是否为本地应用程序? 解决方案

在你的应用程序获得控制权之后,你只需要就可以使用这样的方法以编程方式使属性文件加载决定:如何在Java App Engine中检查,如果我们在开发工作站上



对于应用程序配置变量(应用程序控制范围之外)或分段/生产方案,我在我的版本控制系统中使用不同的分支。该策略在以下答案中进行了描述:


What is the best way to store environment specific variables for Java Google App Engine. Right now I am storing the different values for urls or index names in a properties files. I just keep getting nervous that I will forget to change the values used for my local machine to the production next time I deploy.

Is there something we can set in app engine for our app to pull from when it's running on app engine and a file for local for example?

解决方案

If the environment variables you have in mind are only needed after your application gets control you could programatically make the properties file loading decision using a method like this: How to check in Java App Engine if we are on development workstation

For app config variables (outside of the app's control) or for staging/production scenarios I'm using different branches in my version control system. The strategy is described in these answers:

这篇关于Google App Engine Java中的环境特定变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆