feat: init
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
use crate::config::AppConfig;
|
||||
use crate::error::AppResult;
|
||||
|
||||
impl AppConfig {
|
||||
pub fn s3_endpoint(&self) -> AppResult<Option<String>> {
|
||||
self.get_env::<String>("APP_S3_ENDPOINT")
|
||||
}
|
||||
|
||||
pub fn s3_region(&self) -> AppResult<String> {
|
||||
self.get_env_or("APP_S3_REGION", "us-east-1".to_string())
|
||||
}
|
||||
|
||||
pub fn s3_access_key(&self) -> AppResult<Option<String>> {
|
||||
self.get_env::<String>("APP_S3_ACCESS_KEY")
|
||||
}
|
||||
|
||||
pub fn s3_secret_key(&self) -> AppResult<Option<String>> {
|
||||
self.get_env::<String>("APP_S3_SECRET_KEY")
|
||||
}
|
||||
|
||||
pub fn s3_bucket(&self) -> AppResult<Option<String>> {
|
||||
self.get_env::<String>("APP_S3_BUCKET")
|
||||
}
|
||||
|
||||
pub fn s3_path_style(&self) -> AppResult<bool> {
|
||||
self.get_env_or("APP_S3_PATH_STYLE", false)
|
||||
}
|
||||
|
||||
pub fn s3_public_url(&self) -> AppResult<Option<String>> {
|
||||
self.get_env::<String>("APP_S3_PUBLIC_URL")
|
||||
}
|
||||
|
||||
pub fn s3_max_connections(&self) -> AppResult<u32> {
|
||||
self.get_env_or("APP_S3_MAX_CONNECTIONS", 50)
|
||||
}
|
||||
|
||||
pub fn s3_idle_timeout(&self) -> AppResult<u64> {
|
||||
self.get_env_or("APP_S3_IDLE_TIMEOUT", 90)
|
||||
}
|
||||
|
||||
pub fn s3_connection_timeout(&self) -> AppResult<u64> {
|
||||
self.get_env_or("APP_S3_CONNECTION_TIMEOUT", 10)
|
||||
}
|
||||
|
||||
pub fn s3_max_retries(&self) -> AppResult<u32> {
|
||||
self.get_env_or("APP_S3_MAX_RETRIES", 3)
|
||||
}
|
||||
|
||||
pub fn s3_upload_part_size(&self) -> AppResult<u64> {
|
||||
self.get_env_or("APP_S3_UPLOAD_PART_SIZE", 8 * 1024 * 1024)
|
||||
}
|
||||
|
||||
pub fn s3_max_upload_size(&self) -> AppResult<u64> {
|
||||
self.get_env_or("APP_S3_MAX_UPLOAD_SIZE", 100 * 1024 * 1024)
|
||||
}
|
||||
|
||||
pub fn s3_presigned_url_expiry(&self) -> AppResult<u64> {
|
||||
self.get_env_or("APP_S3_PRESIGNED_URL_EXPIRY", 3600)
|
||||
}
|
||||
|
||||
pub fn s3_force_path_style(&self) -> AppResult<bool> {
|
||||
self.get_env_or("APP_S3_FORCE_PATH_STYLE", false)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user