diff --git a/Assets/Secrets/Secrets.cs b/Assets/Secrets/Secrets.cs
index c6d9656..7040cb5 100644
--- a/Assets/Secrets/Secrets.cs
+++ b/Assets/Secrets/Secrets.cs
@@ -11,10 +11,10 @@ public static class Secrets
public static string bot_refresh_token; //hai
public static void EnvironmentVariables()
{
- client_id = Environment.GetEnvironmentVariable("client_id");
- client_secret = Environment.GetEnvironmentVariable("client_secret");
- bot_access_token = Environment.GetEnvironmentVariable("bot_access_token");
- bot_refresh_token = Environment.GetEnvironmentVariable("bot_refresh_token");
+ client_id = GetVariable("client_id");
+ client_secret = GetVariable("client_secret");
+ bot_access_token = GetVariable("bot_access_token");
+ bot_refresh_token = GetVariable("bot_refresh_token");
/*
string value;
bool toDelete = false;
@@ -37,4 +37,15 @@ public static void EnvironmentVariables()
bot_refresh_token = Environment.GetEnvironmentVariable("bot_refresh_token");
*/
}
+
+ /// Gets the environment variable at any target level.
+ /// Attempts to get the environment variable in the order process-wide, user-wide, and finally machine-wide.
+ /// The name of the environment variable
+ /// Returns the value of environment variable or null if not found at any level
+ public static string GetVariable(string name)
+ {
+ return Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process) ??
+ Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.User) ??
+ Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Machine);
+ }
}