mirror of
https://github.com/Xevion/banner.git
synced 2025-12-06 01:14:22 -06:00
chore: drop env prefixed config vars
This commit is contained in:
@@ -23,8 +23,7 @@ async fn main() -> Result<()> {
|
|||||||
|
|
||||||
// Load configuration
|
// Load configuration
|
||||||
let config: Config = Figment::new()
|
let config: Config = Figment::new()
|
||||||
.merge(Env::raw().only(&["DATABASE_URL"]))
|
.merge(Env::raw())
|
||||||
.merge(Env::prefixed("APP_"))
|
|
||||||
.extract()
|
.extract()
|
||||||
.expect("Failed to load config");
|
.expect("Failed to load config");
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use fundu::{DurationParser, TimeUnit};
|
|||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
/// Application configuration loaded from environment variables
|
/// Main application configuration containing all sub-configurations
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Log level for the application
|
/// Log level for the application
|
||||||
@@ -20,8 +20,6 @@ pub struct Config {
|
|||||||
/// Defaults to "info" if not specified
|
/// Defaults to "info" if not specified
|
||||||
#[serde(default = "default_log_level")]
|
#[serde(default = "default_log_level")]
|
||||||
pub log_level: String,
|
pub log_level: String,
|
||||||
/// Discord bot token for authentication
|
|
||||||
pub bot_token: String,
|
|
||||||
/// Port for the web server
|
/// Port for the web server
|
||||||
#[serde(default = "default_port")]
|
#[serde(default = "default_port")]
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
@@ -29,10 +27,6 @@ pub struct Config {
|
|||||||
pub database_url: String,
|
pub database_url: String,
|
||||||
/// Redis connection URL
|
/// Redis connection URL
|
||||||
pub redis_url: String,
|
pub redis_url: String,
|
||||||
/// Base URL for banner generation service
|
|
||||||
pub banner_base_url: String,
|
|
||||||
/// Target Discord guild ID where the bot operates
|
|
||||||
pub bot_target_guild: u64,
|
|
||||||
/// Graceful shutdown timeout duration
|
/// Graceful shutdown timeout duration
|
||||||
///
|
///
|
||||||
/// Accepts both numeric values (seconds) and duration strings
|
/// Accepts both numeric values (seconds) and duration strings
|
||||||
@@ -42,6 +36,13 @@ pub struct Config {
|
|||||||
deserialize_with = "deserialize_duration"
|
deserialize_with = "deserialize_duration"
|
||||||
)]
|
)]
|
||||||
pub shutdown_timeout: Duration,
|
pub shutdown_timeout: Duration,
|
||||||
|
/// Discord bot token for authentication
|
||||||
|
pub bot_token: String,
|
||||||
|
/// Target Discord guild ID where the bot operates
|
||||||
|
pub bot_target_guild: u64,
|
||||||
|
|
||||||
|
/// Base URL for banner generation service
|
||||||
|
pub banner_base_url: String,
|
||||||
/// Rate limiting configuration for Banner API requests
|
/// Rate limiting configuration for Banner API requests
|
||||||
#[serde(default = "default_rate_limiting")]
|
#[serde(default = "default_rate_limiting")]
|
||||||
pub rate_limiting: RateLimitingConfig,
|
pub rate_limiting: RateLimitingConfig,
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ async fn main() {
|
|||||||
|
|
||||||
// Load configuration first to get log level
|
// Load configuration first to get log level
|
||||||
let config: Config = Figment::new()
|
let config: Config = Figment::new()
|
||||||
.merge(Env::raw().only(&["DATABASE_URL"]))
|
.merge(Env::raw())
|
||||||
.merge(Env::prefixed("APP_"))
|
|
||||||
.extract()
|
.extract()
|
||||||
.expect("Failed to load config");
|
.expect("Failed to load config");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user