Repository navigation
Added config file support - #142
Merged
Merged
Conversation
Zabuzard
requested review from
I-Al-Istannen,
illuminator3 and
marko-radosavljevic
September 22, 2021 15:46
Closed
Zabuzard
commented
Sep 22, 2021
Zabuzard
left a comment
Member
Author
There was a problem hiding this comment.
@I-Al-Istannen Please prepare the VPS with the corresponding config files before this is merged, otherwise the bot crashes.
illuminator3
requested changes
Sep 22, 2021
illuminator3
approved these changes
Sep 22, 2021
|
Kudos, SonarCloud Quality Gate passed! |
I-Al-Istannen
approved these changes
Sep 22, 2021
I-Al-Istannen
left a comment
Contributor
There was a problem hiding this comment.
I'd prefer passing it around but I can also live with the singleton here
marko-radosavljevic
approved these changes
Sep 22, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








What is this?
Implements #100 , i.e. adding support for a configuration file. Replaces the previous
argssystem.Technical details
The configuration file is using JSON (result of votes in #100 ), using Jackson to deserialize it.
argsnow expects either no or a single argument (the path to the config file), if none was given, it will assumeconfig.jsonas 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:{ "token": "<your_token_here>", "databasePath": "db/database.db", "projectWebsite": "https://github.com/Together-Java/TJ-Bot", "discordGuildInvite": "https://discord.com/invite/XXFUXzK" }(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).