Environment variables can be defined in .env file instead

This commit is contained in:
ModulatingForce 2023-12-02 02:00:51 -05:00
parent 27b504012e
commit dec7cb0236
3 changed files with 8 additions and 5 deletions

3
.gitignore vendored
View file

@ -14,4 +14,5 @@ target/
/target /target
# env # env
.envrc .envrc
.env

View file

@ -5,8 +5,7 @@ test ModulatingForceBot
## Usage ## Usage
Set the following environment variables 1. Set the following environment variables ; either on environment variables or in an .env file
`access_token = <oath token>` `access_token = <oath token>`
`bot_channels = <chnl1>,<chnl2>`
`bot_channels = <chnl1>,<chnl2>`

View file

@ -8,11 +8,14 @@ use twitch_irc::message::ServerMessage;
use std::env; use std::env;
use std::time::Instant; use std::time::Instant;
use rand::Rng; use rand::Rng;
use dotenv::dotenv;
// mod helpers; // mod helpers;
#[tokio::main] #[tokio::main]
pub async fn main() { pub async fn main() {
dotenv().ok();
let login_name = "modulatingforcebot".to_owned(); let login_name = "modulatingforcebot".to_owned();
let oauth_token = env::var("access_token").unwrap().to_owned(); let oauth_token = env::var("access_token").unwrap().to_owned();