mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-22 17:44:22 +00:00
Start work on updating micronfig
This commit is contained in:
parent
d86efd6362
commit
4c9beea15f
3 changed files with 43 additions and 46 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -992,9 +992,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "micronfig"
|
name = "micronfig"
|
||||||
version = "0.1.2"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09d5fa5735feed9ff4d6fc550793ef80d18b90f33f3f89af6176318f295383cd"
|
checksum = "caf3c1187adebdc5ad8ca94618b966fe8f40e4a3c80fa2f3eaee47891b410156"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
|
|
|
@ -33,7 +33,7 @@ hmac = { version = "0.12.1", optional = true }
|
||||||
sha2 = { version = "0.10.6", optional = true }
|
sha2 = { version = "0.10.6", optional = true }
|
||||||
# exec
|
# exec
|
||||||
pretty_env_logger = { version = "0.4.0", optional = true }
|
pretty_env_logger = { version = "0.4.0", optional = true }
|
||||||
micronfig = { version = "0.1.2", optional = true }
|
micronfig = { version = "0.2.0", optional = true }
|
||||||
# data
|
# data
|
||||||
serde = { version = "1.0.140", features = ["derive"] }
|
serde = { version = "1.0.140", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.82" }
|
serde_json = { version = "1.0.82" }
|
||||||
|
|
|
@ -5,61 +5,55 @@
|
||||||
/// Configuration required by the `exec` feature.
|
/// Configuration required by the `exec` feature.
|
||||||
#[cfg(feature = "exec")]
|
#[cfg(feature = "exec")]
|
||||||
pub mod exec {
|
pub mod exec {
|
||||||
lazy_static::lazy_static! {
|
|
||||||
/// The locale that card data should be downloaded in.
|
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
///
|
|
||||||
/// - `en_US`
|
|
||||||
/// - `it_IT`
|
|
||||||
///
|
|
||||||
pub static ref DATA_DRAGON_LOCALE: String =
|
|
||||||
micronfig::required("DATA_DRAGON_LOCALE");
|
|
||||||
|
|
||||||
/// The set codes for which card data should be downloaded, separated by commas.
|
/// The locale that card data should be downloaded in.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// - `set1,set2,set3`
|
/// - `en_US`
|
||||||
/// - `set1`
|
/// - `it_IT`
|
||||||
/// - `set1,set2,set3,set4,set5,set6,set6cde,set7`
|
///
|
||||||
///
|
micronfig::required!(DATA_DRAGON_LOCALE, String);
|
||||||
pub static ref DATA_DRAGON_SET_CODES: Vec<String> =
|
|
||||||
micronfig::required::<String>("DATA_DRAGON_SET_CODES")
|
/// The set codes for which card data should be downloaded, separated by commas.
|
||||||
.split(",").map(|s: &str| s.to_string()).collect();
|
///
|
||||||
}
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// - `set1,set2,set3`
|
||||||
|
/// - `set1`
|
||||||
|
/// - `set1,set2,set3,set4,set5,set6,set6cde,set7`
|
||||||
|
///
|
||||||
|
micronfig::required!(DATA_DRAGON_SET_CODES, String);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration required by the `jpg` feature.
|
/// Configuration required by the `jpg` feature.
|
||||||
#[cfg(feature = "jpg")]
|
#[cfg(feature = "jpg")]
|
||||||
pub mod jpg {
|
pub mod jpg {
|
||||||
lazy_static::lazy_static! {
|
|
||||||
/// Secret key configured in imgproxy.
|
|
||||||
pub static ref POROXY_KEY: Vec<u8> = micronfig::required("POROXY_KEY");
|
|
||||||
|
|
||||||
/// Salt configured in imgproxy.
|
/// Secret key configured in imgproxy.
|
||||||
pub static ref POROXY_SALT: String = micronfig::required("POROXY_SALT");
|
micronfig::required!(POROXY_KEY, Vec<u8>);
|
||||||
|
|
||||||
/// URL where imgproxy can be reached at.
|
/// Salt configured in imgproxy.
|
||||||
pub static ref POROXY_HOST: String = micronfig::required("POROXY_HOST");
|
micronfig::required!(POROXY_SALT, String);
|
||||||
}
|
|
||||||
|
/// URL where imgproxy can be reached at.
|
||||||
|
micronfig::required!(POROXY_HOST, String);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration required by the `discord` feature.
|
/// Configuration required by the `discord` feature.
|
||||||
#[cfg(feature = "discord")]
|
#[cfg(feature = "discord")]
|
||||||
pub mod discord {
|
pub mod discord {
|
||||||
lazy_static::lazy_static! {
|
|
||||||
/// ID of the guild where commands should be registered in.
|
|
||||||
///
|
|
||||||
/// If not defined, commands are registered globally, and then cached.
|
|
||||||
///
|
|
||||||
/// Useful for development, since guild commands are not cached.
|
|
||||||
pub static ref SERENITY_DEV_GUILD_ID: Option<serenity::model::id::GuildId> = micronfig::optional("SERENITY_DEV_GUILD_ID").map(|s: u64| s.into());
|
|
||||||
|
|
||||||
/// The Discord bot token.
|
/// ID of the guild where commands should be registered in.
|
||||||
pub static ref SERENITY_TOKEN: String = micronfig::required("SERENITY_TOKEN");
|
///
|
||||||
|
/// If not defined, commands are registered globally, and then cached.
|
||||||
|
///
|
||||||
|
/// Useful for development, since guild commands are not cached.
|
||||||
|
micronfig::optional!(SERENITY_DEV_GUILD_ID, serenity::model::id::GuildId);
|
||||||
|
|
||||||
/// The Discord bot app ID.
|
/// The Discord bot token.
|
||||||
pub static ref SERENITY_APPID: u64 = micronfig::required("SERENITY_APPID");
|
micronfig::required!(SERENITY_TOKEN, String);
|
||||||
}
|
|
||||||
|
/// The Discord bot app ID.
|
||||||
|
micronfig::required!(SERENITY_APPID, u64);
|
||||||
}
|
}
|
Loading…
Reference in a new issue