-
-
Notifications
You must be signed in to change notification settings - Fork 92
Added config file support #142
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@I-Al-Istannen Please prepare the VPS with the corresponding config files before this is merged, otherwise the bot crashes.
application/src/main/java/org/togetherjava/tjbot/Application.java
Outdated
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer passing it around but I can also live with the singleton here
What is this?
Implements #100 , i.e. adding support for a configuration file. Replaces the previous
args
system.Technical details
The configuration file is using JSON (result of votes in #100 ), using Jackson to deserialize it.
args
now expects either no or a single argument (the path to the config file), if none was given, it will assumeconfig.json
as path.Example
For testing it locally, create
TJ-Bot\application\config.json
(or if running from a jar, put it right next to the jar) with content like:(the wiki will be updated with this information as soon as this is merged)
Singleton?
I went for a singleton to make it easier to use
Config
. Personally, I would prefer passing it around explicitly though - but I am okay with making an exception for a configuration. If you prefer passing it around explicitly, please tell me, then I will refactor that aspect (be aware that the consequence is populating all your constructors and methods with possibly lots of config arguments then though).