fix: do some fix
This commit is contained in:
@@ -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("."),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user