Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Assets/Secrets/Secrets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,4 +37,15 @@ public static void EnvironmentVariables()
bot_refresh_token = Environment.GetEnvironmentVariable("bot_refresh_token");
*/
}

/// <summary>Gets the environment variable at any target level.</summary>
/// <remarks>Attempts to get the environment variable in the order process-wide, user-wide, and finally machine-wide.</remarks>
/// <param name="name">The name of the environment variable</param>
/// <returns>Returns the value of environment variable or null if not found at any level</returns>
public static string GetVariable(string name)
{
return Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process) ??
Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.User) ??
Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Machine);
}
}