开发者

Windows - Private hosts file for a certain environment

开发者 https://www.devze.com 2023-04-03 11:43 出处:网络
I\'ve an application running on a dev server and connecting to a dev-db hosting an oracle instance. Now i\'m deploying the on a prod/prod-db machi开发者_如何学Cne

I've an application running on a dev server and connecting to a dev-db hosting an oracle instance.

Now i'm deploying the on a prod/prod-db machi开发者_如何学Cne

Since the dev-db url is hardcoded inside the java code, the just-copied binaries still points to dev-db. As a quick warkaround i added a line in Windows Host file on prod so that dev-db now points to prod-db IP address. It's work, but i'm not very satisfied of this global-scope solution.

I was wondering if exits a way to make a hosts file "private" for a certain environments ie. only valid in the scope of my running application


No, there's no way to do this, and it's a bad approach anyway.

You should instead fix the real problem, which is the hard-coding of the address inside your java code. Put such things in a properties file, and use a different properties file for production.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号