Pergunta

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 machine

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

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top