Sidelined Google Cloud integration for local config
This commit is contained in:
parent
0b0c91b6a8
commit
1f74301935
@ -5,7 +5,7 @@
|
|||||||
package dev.salmonllama.fsbot;
|
package dev.salmonllama.fsbot;
|
||||||
|
|
||||||
import dev.salmonllama.fsbot.config.BotConfig;
|
import dev.salmonllama.fsbot.config.BotConfig;
|
||||||
import dev.salmonllama.fsbot.config.SecretManager;
|
// import dev.salmonllama.fsbot.config.SecretManager;
|
||||||
import dev.salmonllama.fsbot.database.FSDB;
|
import dev.salmonllama.fsbot.database.FSDB;
|
||||||
import dev.salmonllama.fsbot.guthix.Guthix;
|
import dev.salmonllama.fsbot.guthix.Guthix;
|
||||||
import dev.salmonllama.fsbot.listeners.*;
|
import dev.salmonllama.fsbot.listeners.*;
|
||||||
@ -25,18 +25,20 @@ public class Main {
|
|||||||
private final static Logger logger = LoggerFactory.getLogger(Main.class);
|
private final static Logger logger = LoggerFactory.getLogger(Main.class);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
BotConfig.initConfig(Constants.BOT_FOLDER, false); // TODO: Sunset the bot config once and for all
|
BotConfig.initConfig(Constants.BOT_FOLDER, false);
|
||||||
|
|
||||||
FSDB.init();
|
FSDB.init();
|
||||||
|
|
||||||
String token;
|
String token;
|
||||||
if (System.getenv("ENVIRONMENT") != null)
|
if (System.getenv("ENVIRONMENT") != null)
|
||||||
{
|
{
|
||||||
token = SecretManager.DISCORD_TOKEN_PROD.getPlainText();
|
token = BotConfig.BOT_TOKEN_PROD;
|
||||||
|
// token = SecretManager.DISCORD_TOKEN_PROD.getPlainText();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
token = SecretManager.DISCORD_TOKEN.getPlainText();
|
token = BotConfig.BOT_TOKEN_DEV;
|
||||||
|
// token = SecretManager.DISCORD_TOKEN.getPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
new DiscordApiBuilder().addIntents(Intent.MESSAGE_CONTENT).setToken(token).login().thenAccept(api -> {
|
new DiscordApiBuilder().addIntents(Intent.MESSAGE_CONTENT).setToken(token).login().thenAccept(api -> {
|
||||||
|
@ -9,7 +9,6 @@ import com.kaaz.configuration.ConfigurationBuilder;
|
|||||||
import com.kaaz.configuration.ConfigurationOption;
|
import com.kaaz.configuration.ConfigurationOption;
|
||||||
import dev.salmonllama.fsbot.utilities.Constants;
|
import dev.salmonllama.fsbot.utilities.Constants;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
@ -74,6 +73,18 @@ public class BotConfig {
|
|||||||
@ConfigurationOption
|
@ConfigurationOption
|
||||||
public static String HOME_SERVER = "Home server here";
|
public static String HOME_SERVER = "Home server here";
|
||||||
|
|
||||||
|
@ConfigurationOption
|
||||||
|
public static String BOT_TOKEN_DEV = "bot token here";
|
||||||
|
|
||||||
|
@ConfigurationOption
|
||||||
|
public static String BOT_TOKEN_PROD = "production token here";
|
||||||
|
|
||||||
|
@ConfigurationOption
|
||||||
|
public static String IMGUR_BEARER = "Bearer token here";
|
||||||
|
|
||||||
|
@ConfigurationOption
|
||||||
|
public static String IMGUR_CLIENT = "client ID here";
|
||||||
|
|
||||||
public static void initConfig(Path filePath, boolean cleanfile) {
|
public static void initConfig(Path filePath, boolean cleanfile) {
|
||||||
try {
|
try {
|
||||||
new ConfigurationBuilder(BotConfig.class, Paths.get(filePath.toString(), Constants.CONFIG_NAME) .toFile()).build(cleanfile);
|
new ConfigurationBuilder(BotConfig.class, Paths.get(filePath.toString(), Constants.CONFIG_NAME) .toFile()).build(cleanfile);
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
package dev.salmonllama.fsbot.endpoints.imgur;
|
package dev.salmonllama.fsbot.endpoints.imgur;
|
||||||
|
|
||||||
import dev.salmonllama.fsbot.config.SecretManager;
|
//import dev.salmonllama.fsbot.config.SecretManager;
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import dev.salmonllama.fsbot.config.BotConfig;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@ -22,8 +24,10 @@ public class ImgurAPIConnection {
|
|||||||
private final Request.Builder requestBuilder;
|
private final Request.Builder requestBuilder;
|
||||||
|
|
||||||
public ImgurAPIConnection() {
|
public ImgurAPIConnection() {
|
||||||
CLIENT_ID = SecretManager.IMGUR_ID.getPlainText();
|
CLIENT_ID = BotConfig.IMGUR_CLIENT;
|
||||||
BEARER_TOKEN = SecretManager.IMGUR_BEARER.getPlainText();
|
BEARER_TOKEN = BotConfig.IMGUR_BEARER;
|
||||||
|
// CLIENT_ID = SecretManager.IMGUR_ID.getPlainText();
|
||||||
|
// BEARER_TOKEN = SecretManager.IMGUR_BEARER.getPlainText();
|
||||||
|
|
||||||
client = new OkHttpClient().newBuilder().build();
|
client = new OkHttpClient().newBuilder().build();
|
||||||
requestBuilder = new Request.Builder();
|
requestBuilder = new Request.Builder();
|
||||||
|
Loading…
Reference in New Issue
Block a user