fix: do some fix

This commit is contained in:
2025-03-09 01:22:30 +08:00
parent f94e175082
commit 07ac7e3376
29 changed files with 422 additions and 628 deletions

View File

@@ -29,7 +29,7 @@ pub struct AppBuilder {
dotenv_file: Option<String>,
config_file: Option<String>,
working_dir: String,
enviornment: Environment,
environment: Environment,
}
impl AppBuilder {
@@ -70,21 +70,21 @@ impl AppBuilder {
pub async fn build(self) -> RResult<App> {
AppConfig::load_dotenv(
&self.enviornment,
&self.environment,
&self.working_dir,
self.dotenv_file.as_deref(),
)
.await?;
let config = AppConfig::load_config(
&self.enviornment,
&self.environment,
&self.working_dir,
self.config_file.as_deref(),
)
.await?;
let app_context = Arc::new(
AppContext::new(self.enviornment.clone(), config, self.working_dir.clone()).await?,
AppContext::new(self.environment.clone(), config, self.working_dir.clone()).await?,
);
Ok(App {
@@ -101,7 +101,7 @@ impl AppBuilder {
pub fn environment(self, environment: Environment) -> Self {
let mut ret = self;
ret.enviornment = environment;
ret.environment = environment;
ret
}
@@ -130,7 +130,7 @@ impl AppBuilder {
impl Default for AppBuilder {
fn default() -> Self {
Self {
enviornment: Environment::Production,
environment: Environment::Production,
dotenv_file: None,
config_file: None,
working_dir: String::from("."),

View File

@@ -34,12 +34,13 @@ impl App {
let mut router = Router::<Arc<dyn AppContextTrait>>::new();
let (graphqlc, oidcc) = try_join!(
let (graphql_c, oidc_c, metadata_c) = try_join!(
controller::graphql::create(context.clone()),
controller::oidc::create(context.clone()),
controller::metadata::create(context.clone())
)?;
for c in [graphqlc, oidcc] {
for c in [graphql_c, oidc_c, metadata_c] {
router = c.apply_to(router);
}