Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use environment variables instead of server.ini by default #74

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AlexandreVassard
Copy link

@AlexandreVassard AlexandreVassard commented Aug 27, 2024

Hello !

In Quackster/Kepler#72, @emansom asked about reading environment variables instead of server.ini by default.

I'm not a Java developer at all, so i did what i can, you are free to give me some advices ! 😄

In the first place, i removed entrypoint.sh, that was used to take env variables to configure server.ini.

After that, i have update the way that Kepler get configuration values.
Instead of just look into server.ini, it will first look in environment variables.
If a value exists in environment, it will take it, if not, we continue what we were doing with server.ini.

Note that variables keys are formated with conventionnal naming of environment variables, so uppercase with underscores.
So if we want to configure server.port we need to use SERVER_PORT.

NOW THE BAD NEWS

One of the Kepler configuration key is mysql.username, so with environment variables it should be MYSQL_USERNAME.
The problem is, using Kepler with Docker, we also use a MariaDB container.
This MariaDB container uses MYSQL_USER.
So if we want to configure our Kepler with Docker & environment variables, we will have this in our .env file :

MYSQL_USERNAME=kepler
MYSQL_USER=kepler

That's why the last commit changes all mysql.username to mysql.user.
I would be happy to know your opinions on that.

PS : Sorry @emansom, since i'm not confortable with Java, Gradle etc... I don't really know how to use jib and stuff.

Was used to configure server.ini with environment variables.
When getting config values, try to get env variable first.

If env variable doesn't exists, we keep the same workflow.
Kepler uses MYSQL_USERNAME as database username, but MariaDB container uses MYSQL_USER.

So, if we use Docker with environment variables, we should use the two variables with the same values.

It's a breaking change, but i won't ask MariaDB to change this variable ^^.

`mysql.user` (`MYSQL_USER` for environment variable) should now be used instead of `mysql.username`
@AlexandreVassard AlexandreVassard changed the title Use environment variables insteand of server.ini by default Use environment variables instead of server.ini by default Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants