pub struct ConfigManager { /* private fields */ }Expand description
ConfigManager menyimpan semua konfigurasi aplikasi yang dimuat dari .env atau file lain.
Implementations§
Source§impl ConfigManager
impl ConfigManager
Sourcepub fn new() -> ConfigManager
pub fn new() -> ConfigManager
Inisialisasi ConfigManager dengan memuat data dari environment variables.
Sourcepub fn set(&mut self, key: &str, value: &str)
pub fn set(&mut self, key: &str, value: &str)
Set atau override nilai konfigurasi secara programatik.
Sourcepub fn get(&self, key: &str) -> Option<String>
pub fn get(&self, key: &str) -> Option<String>
Ambil nilai konfigurasi berdasarkan key. Contoh: config.get(“APP_NAME”)
Sourcepub fn get_or(&self, key: &str, default: &str) -> String
pub fn get_or(&self, key: &str, default: &str) -> String
Ambil nilai konfigurasi dengan fallback default.
Sourcepub fn get_bool(&self, key: &str, default: bool) -> bool
pub fn get_bool(&self, key: &str, default: bool) -> bool
Ambil nilai konfigurasi sebagai boolean.
Sourcepub fn get_db_url(&self) -> String
pub fn get_db_url(&self) -> String
Membangun DATABASE_URL dari variabel DB_* ala Laravel atau mengambil langsung dari DATABASE_URL.
Auto Trait Implementations§
impl Forget for ConfigManager
impl Freeze for ConfigManager
impl Move for ConfigManager
impl RefUnwindSafe for ConfigManager
impl Send for ConfigManager
impl Sync for ConfigManager
impl Unpin for ConfigManager
impl UnsafeUnpin for ConfigManager
impl UnwindSafe for ConfigManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more