mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: integrate postgres storage (#2604)
* chore: env config * chore: get user workspace * feat: enable postgres storage * chore: add new env * chore: add set env ffi * chore: pass env before backend init * chore: update * fix: ci tests * chore: commit the generate env file * chore: remove unused import
This commit is contained in:
19
frontend/rust-lib/dart-ffi/src/env_serde.rs
Normal file
19
frontend/rust-lib/dart-ffi/src/env_serde.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use appflowy_integrate::SupabaseDBConfig;
|
||||
use flowy_server::supabase::SupabaseConfiguration;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct AppFlowyEnv {
|
||||
supabase_config: SupabaseConfiguration,
|
||||
supabase_db_config: SupabaseDBConfig,
|
||||
}
|
||||
|
||||
impl AppFlowyEnv {
|
||||
pub fn parser(env_str: &str) {
|
||||
if let Ok(env) = serde_json::from_str::<AppFlowyEnv>(env_str) {
|
||||
dbg!(&env);
|
||||
env.supabase_config.write_env();
|
||||
env.supabase_db_config.write_env();
|
||||
}
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ use flowy_notification::register_notification_sender;
|
||||
use lib_dispatch::prelude::ToBytes;
|
||||
use lib_dispatch::prelude::*;
|
||||
|
||||
use crate::env_serde::AppFlowyEnv;
|
||||
use crate::notification::DartNotificationSender;
|
||||
use crate::{
|
||||
c::{extend_front_four_bytes_into_bytes, forget_rust},
|
||||
@ -17,6 +18,7 @@ use crate::{
|
||||
};
|
||||
|
||||
mod c;
|
||||
mod env_serde;
|
||||
mod model;
|
||||
mod notification;
|
||||
mod protobuf;
|
||||
@ -134,3 +136,10 @@ pub extern "C" fn backend_log(level: i64, data: *const c_char) {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn set_env(data: *const c_char) {
|
||||
let c_str = unsafe { CStr::from_ptr(data) };
|
||||
let serde_str = c_str.to_str().unwrap();
|
||||
AppFlowyEnv::parser(serde_str);
|
||||
}
|
||||
|
Reference in New Issue
Block a user