pub struct Config {
pub wechat_app_id: String,
pub wechat_app_secret: String,
pub openai_api_key: Option<String>,
pub gemini_api_key: Option<String>,
pub verbose: bool,
}Expand description
Configuration for the wx-uploader application
Contains all necessary API keys and settings for WeChat and OpenAI integration.
Fields§
§wechat_app_id: StringWeChat application ID
wechat_app_secret: StringWeChat application secret
openai_api_key: Option<String>Optional OpenAI API key for cover image generation
gemini_api_key: Option<String>Optional Gemini API key for cover image generation
verbose: boolEnable verbose logging
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Creates a new configuration from environment variables
§Required Environment Variables
WECHAT_APP_ID: WeChat application IDWECHAT_APP_SECRET: WeChat application secret
§Optional Environment Variables
OPENAI_API_KEY: OpenAI API key for cover image generation
§Errors
Returns an error if required environment variables are not set
Sourcepub fn new(
wechat_app_id: String,
wechat_app_secret: String,
openai_api_key: Option<String>,
gemini_api_key: Option<String>,
verbose: bool,
) -> Self
pub fn new( wechat_app_id: String, wechat_app_secret: String, openai_api_key: Option<String>, gemini_api_key: Option<String>, verbose: bool, ) -> Self
Creates a new configuration with explicit values
Sourcepub fn with_verbose(self, verbose: bool) -> Self
pub fn with_verbose(self, verbose: bool) -> Self
Sets the verbose flag
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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