Automated the token selection process.
This commit is contained in:
parent
f8e88a84b0
commit
e53143bd64
@ -28,7 +28,17 @@ public class Main {
|
|||||||
|
|
||||||
FSDB.init();
|
FSDB.init();
|
||||||
|
|
||||||
new DiscordApiBuilder().setToken(SecretManager.DISCORD_TOKEN.getPlainText()).login().thenAccept(api -> {
|
String token;
|
||||||
|
if (System.getenv("ENVIRONMENT") != null)
|
||||||
|
{
|
||||||
|
token = SecretManager.DISCORD_TOKEN_PROD.getPlainText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
token = SecretManager.DISCORD_TOKEN.getPlainText();
|
||||||
|
}
|
||||||
|
|
||||||
|
new DiscordApiBuilder().setToken(token).login().thenAccept(api -> {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Guthix guthix = new Guthix(api);
|
Guthix guthix = new Guthix(api);
|
||||||
|
@ -6,6 +6,7 @@ import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
|
|||||||
|
|
||||||
public enum SecretManager {
|
public enum SecretManager {
|
||||||
DISCORD_TOKEN ("projects/fashionscapers-212707/secrets/fs_discord_token/versions/1"),
|
DISCORD_TOKEN ("projects/fashionscapers-212707/secrets/fs_discord_token/versions/1"),
|
||||||
|
DISCORD_TOKEN_PROD ("projects/fashionscapers-212707/secrets/fs_discord_token_prod/versions/1"),
|
||||||
IMGUR_ID ("projects/fashionscapers-212707/secrets/fs_imgur_client_id/versions/1"),
|
IMGUR_ID ("projects/fashionscapers-212707/secrets/fs_imgur_client_id/versions/1"),
|
||||||
IMGUR_BEARER ("projects/fashionscapers-212707/secrets/fs_imgur_bearer_token/versions/1")
|
IMGUR_BEARER ("projects/fashionscapers-212707/secrets/fs_imgur_bearer_token/versions/1")
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user