feat: configuration comments and getters
All checks were successful
build / build (push) Successful in 1m36s
All checks were successful
build / build (push) Successful in 1m36s
This commit is contained in:
parent
cac64864c6
commit
fa187bb766
1 changed files with 34 additions and 5 deletions
|
@ -49,12 +49,41 @@ public class OAuthFabricConfig {
|
|||
// Which database to use (SQLite is currently the only supported database).
|
||||
private String database;
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return client_id;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return client_secret;
|
||||
}
|
||||
|
||||
public String getRedirectUri() {
|
||||
return redirect_uri;
|
||||
}
|
||||
|
||||
public String getDatabase() {
|
||||
return database;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
this.config.getOrElse("provider", DEFAULT_PROVIDER);
|
||||
this.config.getOrElse("client_id", DEFAULT_CLIENT_ID);
|
||||
this.config.getOrElse("client_secret", DEFAULT_CLIENT_SECRET);
|
||||
this.config.getOrElse("redirect_uri", DEFAULT_REDIRECT_URI);
|
||||
this.config.getOrElse("database", DEFAULT_DATABASE);
|
||||
this.config.setComment("provider", "URL to the OAuth provider (e.g. accounts.google.com, discord.com/oauth2)");
|
||||
this.config.set("provider", DEFAULT_PROVIDER);
|
||||
|
||||
this.config.setComment("client_id", "ID of the OAuth client. This is usually defined when creating the OAuth application.");
|
||||
this.config.set("client_id", DEFAULT_CLIENT_ID);
|
||||
|
||||
this.config.setComment("client_secret", "");
|
||||
this.config.set("client_secret", DEFAULT_CLIENT_SECRET);
|
||||
|
||||
this.config.setComment("redirect_uri", "URI to redirect to. Ensure that this URI is listed in the allowed redirect URIs section of your OAuth provider.");
|
||||
this.config.set("redirect_uri", DEFAULT_REDIRECT_URI);
|
||||
|
||||
this.config.setComment("database", "Which database to use (SQLite is currently the only supported database).");
|
||||
this.config.set("database", DEFAULT_DATABASE);
|
||||
|
||||
try {
|
||||
this.loadFromFile(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue