CUTR-at-USF / ontime-performance-calculator

An application to calculate on-time performance using archived GTFS-realtime data
Other
4 stars 2 forks source link

Move info.txt out of `/target` folder #5

Closed barbeau closed 7 years ago

barbeau commented 7 years ago

Currently, the info.txt file that contains the database credentials is assumed to be in the /target directory - see https://github.com/CUTR-at-USF/ontime-performance-calculator#4-run-the-application.

This can cause problems, as the /target directory could potentially be deleted when running mvn clean.

We should move it into the project structure itself, so it can be read when running from an IDE (i.e., on the classpath) as well as when it gets packaged into the JAR after the project is built.

I believe you can do this by moving the info.txt to the src/main/resources directory, and read it from there instead - see http://stackoverflow.com/questions/20389255/reading-a-resource-file-from-within-jar.

I recall there being a catch to this the last time I had to implement it relating to reading the file both within the IDE and within a packaged JAR, but I can't recall exactly what that was. I want to say that the accepted answer to the above StackOverflow question worked, but for some reason I didn't upvote it.

If this becomes difficult, we can always just read directly from the project root folder - the main goal is just to move the file out of /target where it could be deleted.

If we move it elsewhere, we need to add that file name to a .gitignore file in that directory to make sure the credentials don't accidentally get committed and pushed to Github.