2023-05-23 15:55:21 +00:00
|
|
|
use serde::Deserialize;
|
|
|
|
|
2023-07-14 05:37:13 +00:00
|
|
|
use flowy_server_config::supabase_config::SupabaseConfiguration;
|
2023-07-05 12:57:09 +00:00
|
|
|
|
2023-05-23 15:55:21 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct AppFlowyEnv {
|
|
|
|
supabase_config: SupabaseConfiguration,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AppFlowyEnv {
|
2023-08-17 15:46:39 +00:00
|
|
|
/// Parse the environment variable from the frontend application. The frontend will
|
|
|
|
/// pass the environment variable as a json string after launching.
|
2023-05-23 15:55:21 +00:00
|
|
|
pub fn parser(env_str: &str) {
|
|
|
|
if let Ok(env) = serde_json::from_str::<AppFlowyEnv>(env_str) {
|
|
|
|
env.supabase_config.write_env();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|