mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-11 12:23:20 +00:00
dynamically flag off voice designer in production
This commit is contained in:
1 parent
2882128a5c
commit
77a2cc3439
2 files changed
+9
-6
No files matched your search
@@ -611,6 +611,7 @@ pub async fn serve(server_state: ServerState) -> AnyhowResult<()>
|
||||
let bind_address = server_state.env_config.bind_address.clone();
|
||||
let num_workers = server_state.env_config.num_workers.clone();
|
||||
let hostname = server_state.hostname.clone();
|
||||
let server_environment = server_state.server_environment.clone();
|
||||
|
||||
let server_state_arc = web::Data::new(Arc::new(server_state));
|
||||
|
||||
@@ -650,13 +651,13 @@ pub async fn serve(server_state: ServerState) -> AnyhowResult<()>
|
||||
.app_data(web::Data::new(server_state_arc.stripe.clone().config.clone()))
|
||||
.app_data(web::Data::new(server_state_arc.stripe.clone().client.clone()))
|
||||
.app_data(web::Data::new(server_state_arc.third_party_url_redirector.clone()))
|
||||
.app_data(web::Data::new(server_state_arc.server_environment.clone()))
|
||||
.app_data(web::Data::new(server_environment))
|
||||
.app_data(web::Data::from(product_lookup)) // NB: Data::from(Arc<T>) for dynamic dispatch
|
||||
.app_data(web::Data::from(stripe_lookup)) // NB: Data::from(Arc<T>) for dynamic dispatch
|
||||
.app_data(web::Data::from(user_lookup)) // NB: Data::from(Arc<T>) for dynamic dispatch
|
||||
.app_data(web::Data::from(session_cache_purge)) // NB: Data::from(Arc<T>) for dynamic dispatch
|
||||
.app_data(server_state_arc.clone())
|
||||
.wrap(build_cors_config(server_state_arc.server_environment.clone()))
|
||||
.wrap(build_cors_config(server_environment))
|
||||
.wrap(DefaultHeaders::new()
|
||||
.header("X-Backend-Hostname", &hostname)
|
||||
.header("X-Build-Sha", server_state_arc.server_info.build_sha.clone()))
|
||||
@@ -669,7 +670,7 @@ pub async fn serve(server_state: ServerState) -> AnyhowResult<()>
|
||||
.exclude("/readiness"))
|
||||
.wrap(middleware::Compress::default());
|
||||
|
||||
add_routes(app)
|
||||
add_routes(app, server_environment)
|
||||
})
|
||||
.bind(bind_address)?
|
||||
.workers(num_workers)
|
||||
|
||||
@@ -3,9 +3,11 @@ use actix_service::ServiceFactory;
|
||||
use actix_web::{App, HttpResponse, web};
|
||||
use actix_web::dev::{ServiceRequest, ServiceResponse};
|
||||
use actix_web::error::Error;
|
||||
use log::warn;
|
||||
|
||||
use actix_helpers::route_builder::RouteBuilder;
|
||||
use billing_component::default_routes::add_suggested_stripe_billing_routes;
|
||||
use reusable_types::server_environment::ServerEnvironment;
|
||||
use users_component::default_routes::add_suggested_api_v1_account_creation_and_session_routes;
|
||||
use users_component::endpoints::edit_profile_handler::edit_profile_handler;
|
||||
use users_component::endpoints::get_profile_handler::get_profile_handler;
|
||||
@@ -140,7 +142,7 @@ use crate::http_server::endpoints::w2l::list_user_w2l_templates::list_user_w2l_t
|
||||
use crate::http_server::endpoints::w2l::list_w2l_templates::list_w2l_templates_handler;
|
||||
use crate::http_server::endpoints::w2l::set_w2l_template_mod_approval::set_w2l_template_mod_approval_handler;
|
||||
|
||||
pub fn add_routes<T, B> (app: App<T>) -> App<T>
|
||||
pub fn add_routes<T, B> (app: App<T>, server_environment: ServerEnvironment) -> App<T>
|
||||
where
|
||||
B: MessageBody,
|
||||
T: ServiceFactory<
|
||||
@@ -173,8 +175,8 @@ pub fn add_routes<T, B> (app: App<T>) -> App<T>
|
||||
app = add_subscription_routes(app); /* /v1/subscriptions/... */
|
||||
|
||||
// TODO find a long term feature flag solution, since this code is likely deployed into production we don't want the route found.
|
||||
let enable_voice_designer_route = true;
|
||||
if enable_voice_designer_route {
|
||||
if !server_environment.is_deployed_in_production() {
|
||||
warn!("Adding voice designer routes (development only)");
|
||||
app = add_voice_designer_routes(app); /* /v1/voice_designer */
|
||||
}
|
||||
// ==================== Comments ====================
|
||||
|
||||
Reference in new issue
Block a user