Rename some environment variables. Add partial deb metadata

This commit is contained in:
jude
2023-03-24 17:44:43 +00:00
parent e5b8c418af
commit 4e0163f2cb
11 changed files with 217 additions and 38 deletions

View File

@ -27,7 +27,7 @@ lazy_static! {
.into();
pub static ref REGEX_CHANNEL_USER: Regex = Regex::new(r#"\s*<(#|@)(?:!)?(\d+)>\s*"#).unwrap();
pub static ref SUBSCRIPTION_ROLES: HashSet<u64> = HashSet::from_iter(
env::var("SUBSCRIPTION_ROLES")
env::var("PATREON_ROLE_ID")
.map(|var| var
.split(',')
.filter_map(|item| { item.parse::<u64>().ok() })
@ -35,7 +35,7 @@ lazy_static! {
.unwrap_or_else(|_| Vec::new())
);
pub static ref CNC_GUILD: Option<u64> =
env::var("CNC_GUILD").map(|var| var.parse::<u64>().ok()).ok().flatten();
env::var("PATREON_GUILD_ID").map(|var| var.parse::<u64>().ok()).ok().flatten();
pub static ref MIN_INTERVAL: i64 =
env::var("MIN_INTERVAL").ok().and_then(|inner| inner.parse::<i64>().ok()).unwrap_or(600);
pub static ref MAX_TIME: i64 = env::var("MAX_TIME")

View File

@ -18,10 +18,10 @@ use std::{
env,
error::Error as StdError,
fmt::{Debug, Display, Formatter},
path::Path,
};
use chrono_tz::Tz;
use dotenv::dotenv;
use log::{error, warn};
use poise::serenity_prelude::model::{
gateway::GatewayIntents,
@ -88,7 +88,9 @@ async fn main() -> Result<(), Box<dyn StdError + Send + Sync>> {
async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
env_logger::init();
dotenv()?;
if Path::new("/etc/soundfx-rs/default.env").exists() {
dotenv::from_path("/etc/soundfx-rs/default.env")?;
}
let discord_token = env::var("DISCORD_TOKEN").expect("Missing DISCORD_TOKEN from environment");