Merge branch 'main' into feat/dup-doc-in-db-row
This commit is contained in:
commit
c9479985c2
|
|
@ -40,4 +40,10 @@ RUN apt-get update -y \
|
||||||
COPY --from=builder /app/target/release/appflowy_cloud /usr/local/bin/appflowy_cloud
|
COPY --from=builder /app/target/release/appflowy_cloud /usr/local/bin/appflowy_cloud
|
||||||
ENV APP_ENVIRONMENT production
|
ENV APP_ENVIRONMENT production
|
||||||
ENV RUST_BACKTRACE 1
|
ENV RUST_BACKTRACE 1
|
||||||
|
|
||||||
|
ARG APPFLOWY_APPLICATION_PORT
|
||||||
|
ARG PORT
|
||||||
|
ENV PORT=${APPFLOWY_APPLICATION_PORT:-${PORT:-8000}}
|
||||||
|
EXPOSE $PORT
|
||||||
|
|
||||||
CMD ["appflowy_cloud"]
|
CMD ["appflowy_cloud"]
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,10 @@ COPY --from=builder /app/target/release/admin_frontend /usr/local/bin/admin_fron
|
||||||
COPY --from=builder /app/admin_frontend/assets /app/assets
|
COPY --from=builder /app/admin_frontend/assets /app/assets
|
||||||
ENV RUST_BACKTRACE 1
|
ENV RUST_BACKTRACE 1
|
||||||
ENV RUST_LOG info
|
ENV RUST_LOG info
|
||||||
|
|
||||||
|
ARG ADMIN_FRONTEND_PORT
|
||||||
|
ARG PORT
|
||||||
|
ENV PORT=${ADMIN_FRONTEND_PORT:-${PORT:-3000}}
|
||||||
|
EXPOSE $PORT
|
||||||
|
|
||||||
CMD ["admin_frontend"]
|
CMD ["admin_frontend"]
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,28 @@ use tracing::warn;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
pub host: String,
|
||||||
|
pub port: u16,
|
||||||
pub redis_url: String,
|
pub redis_url: String,
|
||||||
pub gotrue_url: String,
|
pub gotrue_url: String,
|
||||||
pub appflowy_cloud_url: String,
|
pub appflowy_cloud_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn from_env() -> Self {
|
pub fn from_env() -> Result<Config, anyhow::Error> {
|
||||||
Config {
|
let cfg = Config {
|
||||||
|
host: get_or_default("ADMIN_FRONTEND_HOST", "0.0.0.0"),
|
||||||
|
port: get_or_default("ADMIN_FRONTEND_PORT", "3000")
|
||||||
|
.parse()
|
||||||
|
.map_err(|e| anyhow::anyhow!("failed to parse ADMIN_FRONTEND_PORT as u16, err: {}", e))?,
|
||||||
redis_url: get_or_default("ADMIN_FRONTEND_REDIS_URL", "redis://localhost:6379"),
|
redis_url: get_or_default("ADMIN_FRONTEND_REDIS_URL", "redis://localhost:6379"),
|
||||||
gotrue_url: get_or_default("ADMIN_FRONTEND_GOTRUE_URL", "http://localhost:9999"),
|
gotrue_url: get_or_default("ADMIN_FRONTEND_GOTRUE_URL", "http://localhost:9999"),
|
||||||
appflowy_cloud_url: get_or_default(
|
appflowy_cloud_url: get_or_default(
|
||||||
"ADMIN_FRONTEND_APPFLOWY_CLOUD_URL",
|
"ADMIN_FRONTEND_APPFLOWY_CLOUD_URL",
|
||||||
"http://localhost:8000",
|
"http://localhost:8000",
|
||||||
),
|
),
|
||||||
}
|
};
|
||||||
|
Ok(cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ async fn main() {
|
||||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
let config = Config::from_env();
|
let config = Config::from_env().unwrap();
|
||||||
info!("config loaded: {:?}", &config);
|
info!("config loaded: {:?}", &config);
|
||||||
|
|
||||||
let gotrue_client = gotrue::api::Client::new(reqwest::Client::new(), &config.gotrue_url);
|
let gotrue_client = gotrue::api::Client::new(reqwest::Client::new(), &config.gotrue_url);
|
||||||
|
|
@ -65,7 +65,8 @@ async fn main() {
|
||||||
.nest_service("/web-api", web_api_router)
|
.nest_service("/web-api", web_api_router)
|
||||||
.nest_service("/assets", ServeDir::new("assets"));
|
.nest_service("/assets", ServeDir::new("assets"));
|
||||||
|
|
||||||
let listener = TcpListener::bind("0.0.0.0:3000")
|
let address = format!("{}:{}", config.host, config.port);
|
||||||
|
let listener = TcpListener::bind(address)
|
||||||
.await
|
.await
|
||||||
.expect("failed to bind to port");
|
.expect("failed to bind to port");
|
||||||
info!("listening on: {:?}", listener);
|
info!("listening on: {:?}", listener);
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,13 @@ use app_error::AppError;
|
||||||
use collab_folder::Folder;
|
use collab_folder::Folder;
|
||||||
use shared_entity::dto::workspace_dto::PublishedView;
|
use shared_entity::dto::workspace_dto::PublishedView;
|
||||||
|
|
||||||
use super::folder_view::{to_dto_view_icon, to_view_layout, view_is_space};
|
use super::folder_view::{to_dto_view_icon, to_view_layout};
|
||||||
|
|
||||||
pub fn collab_folder_to_published_outline(
|
pub fn collab_folder_to_published_outline(
|
||||||
folder: &Folder,
|
folder: &Folder,
|
||||||
publish_view_ids: &HashSet<String>,
|
publish_view_ids: &HashSet<String>,
|
||||||
) -> Result<PublishedView, AppError> {
|
) -> Result<PublishedView, AppError> {
|
||||||
let mut unviewable = HashSet::new();
|
let mut unviewable = HashSet::new();
|
||||||
for private_section in folder.get_all_private_sections() {
|
|
||||||
unviewable.insert(private_section.id);
|
|
||||||
}
|
|
||||||
for trash_view in folder.get_all_trash_sections() {
|
for trash_view in folder.get_all_trash_sections() {
|
||||||
unviewable.insert(trash_view.id);
|
unviewable.insert(trash_view.id);
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +114,7 @@ fn to_publish_view(
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let is_published = publish_view_ids.contains(view_id);
|
let is_published = publish_view_ids.contains(view_id);
|
||||||
if view_is_space(&view) || is_published || !pruned_view.is_empty() {
|
if is_published || !pruned_view.is_empty() {
|
||||||
Some(PublishedView {
|
Some(PublishedView {
|
||||||
view_id: view.id.clone(),
|
view_id: view.id.clone(),
|
||||||
name: view.name.clone(),
|
name: view.name.clone(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue