1

I have a project which currently runs locally.

I have all my configuration hard-coded in a class. (DB IP, DB Username, DB Password, FTP IP, FTP Username, FTP Password)

This makes it very difficult to deploy the project on Local/Test/Production Environments unless they use the same IP, UserName, Passwords.

I want to be able to share the project and not share any credentials.

Where and how do I store these credentials?

I currently use Gradle for building the project.

Deployment is done using Jenkins

The project is shared on GitHub

Stole
  • 4,978
  • 3
  • 20
  • 18
  • 3
    Possible duplicate of [How to use Java property files?](https://stackoverflow.com/questions/1318347/how-to-use-java-property-files) – Progman Nov 24 '18 at 12:26
  • 2
    Various options. 1. Read from an external property file which exists in each environment. Set JVM properties. 2. Pass as JVM args: http://www.avajava.com/tutorials/lessons/how-do-i-set-system-properties.html?page=2 – Alan Hay Nov 24 '18 at 12:28
  • are you using spring framework? – alex Nov 24 '18 at 12:36

1 Answers1

-3

Start by evaluating your application and comparing it against https://12factor.net especially https://12factor.net/config

Typically you would want to externalise your configurations into some files (*.properties or *.yaml). Each files represent an environment (dev, test, prod).

Lastly, make sure your Gradle project should only produce 1 generic artefact.

Quirino Gervacio
  • 1,240
  • 9
  • 9