env_serde.rs 518 B

123456789101112131415161718
  1. use serde::Deserialize;
  2. use flowy_server_config::supabase_config::SupabaseConfiguration;
  3. #[derive(Deserialize, Debug)]
  4. pub struct AppFlowyEnv {
  5. supabase_config: SupabaseConfiguration,
  6. }
  7. impl AppFlowyEnv {
  8. /// Parse the environment variable from the frontend application. The frontend will
  9. /// pass the environment variable as a json string after launching.
  10. pub fn parser(env_str: &str) {
  11. if let Ok(env) = serde_json::from_str::<AppFlowyEnv>(env_str) {
  12. env.supabase_config.write_env();
  13. }
  14. }
  15. }