Compare commits
No commits in common. "94c4428bb0d0eca3e3da1a9ac29148017df6c3ba" and "556337aa4e13617839e70d24e51ba46fbf9db6b2" have entirely different histories.
94c4428bb0
...
556337aa4e
8 changed files with 13 additions and 18 deletions
|
@ -18,8 +18,7 @@ RUN useradd --create-home --home-dir /gorb gorb
|
||||||
|
|
||||||
USER gorb
|
USER gorb
|
||||||
|
|
||||||
ENV WEB_FRONTEND_URL=https://gorb.app/web/ \
|
ENV WEB_URL=https://gorb.app/web/ \
|
||||||
WEB_BASE_PATH=/api \
|
|
||||||
DATABASE_USERNAME=gorb \
|
DATABASE_USERNAME=gorb \
|
||||||
DATABASE_PASSWORD=gorb \
|
DATABASE_PASSWORD=gorb \
|
||||||
DATABASE=gorb \
|
DATABASE=gorb \
|
||||||
|
|
|
@ -18,7 +18,7 @@ services:
|
||||||
- gorb-backend:/gorb
|
- gorb-backend:/gorb
|
||||||
environment:
|
environment:
|
||||||
#- RUST_LOG=debug
|
#- RUST_LOG=debug
|
||||||
- WEB_FRONTEND_URL=https://gorb.app/web/
|
- WEB_URL=https://gorb.app/web/
|
||||||
- DATABASE_USERNAME=gorb
|
- DATABASE_USERNAME=gorb
|
||||||
- DATABASE_PASSWORD=gorb
|
- DATABASE_PASSWORD=gorb
|
||||||
- DATABASE=gorb
|
- DATABASE=gorb
|
||||||
|
|
|
@ -16,7 +16,7 @@ services:
|
||||||
- gorb-backend:/gorb
|
- gorb-backend:/gorb
|
||||||
environment:
|
environment:
|
||||||
#- RUST_LOG=debug
|
#- RUST_LOG=debug
|
||||||
- WEB_FRONTEND_URL=https://gorb.app/web/
|
- WEB_URL=https://gorb.app/web/
|
||||||
- DATABASE_USERNAME=gorb
|
- DATABASE_USERNAME=gorb
|
||||||
- DATABASE_PASSWORD=gorb
|
- DATABASE_PASSWORD=gorb
|
||||||
- DATABASE=gorb
|
- DATABASE=gorb
|
||||||
|
|
|
@ -11,8 +11,7 @@ fi
|
||||||
if [ ! -f "/gorb/config/config.toml" ]; then
|
if [ ! -f "/gorb/config/config.toml" ]; then
|
||||||
cat > /gorb/config/config.toml <<EOF
|
cat > /gorb/config/config.toml <<EOF
|
||||||
[web]
|
[web]
|
||||||
frontend_url = "${WEB_FRONTEND_URL}"
|
url = "${WEB_URL}"
|
||||||
base_path = "${WEB_BASE_PATH}"
|
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
username = "${DATABASE_USERNAME}"
|
username = "${DATABASE_USERNAME}"
|
||||||
|
|
|
@ -6,6 +6,6 @@ use actix_web::web;
|
||||||
mod v1;
|
mod v1;
|
||||||
mod versions;
|
mod versions;
|
||||||
|
|
||||||
pub fn web(path: &str) -> Scope {
|
pub fn web() -> Scope {
|
||||||
web::scope(path.trim_end_matches('/')).service(v1::web()).service(versions::get)
|
web::scope("/api").service(v1::web()).service(versions::get)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,7 @@ pub struct CacheDatabase {
|
||||||
struct WebBuilder {
|
struct WebBuilder {
|
||||||
ip: Option<String>,
|
ip: Option<String>,
|
||||||
port: Option<u16>,
|
port: Option<u16>,
|
||||||
base_path: Option<String>,
|
url: Url,
|
||||||
frontend_url: Url,
|
|
||||||
_ssl: Option<bool>,
|
_ssl: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +85,7 @@ impl ConfigBuilder {
|
||||||
let web = Web {
|
let web = Web {
|
||||||
ip: self.web.ip.unwrap_or(String::from("0.0.0.0")),
|
ip: self.web.ip.unwrap_or(String::from("0.0.0.0")),
|
||||||
port: self.web.port.unwrap_or(8080),
|
port: self.web.port.unwrap_or(8080),
|
||||||
base_path: self.web.base_path.unwrap_or("".to_string()),
|
url: self.web.url,
|
||||||
frontend_url: self.web.frontend_url,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let endpoint = match &*self.bunny.endpoint {
|
let endpoint = match &*self.bunny.endpoint {
|
||||||
|
@ -148,8 +146,7 @@ pub struct Config {
|
||||||
pub struct Web {
|
pub struct Web {
|
||||||
pub ip: String,
|
pub ip: String,
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
pub base_path: String,
|
pub url: Url,
|
||||||
pub frontend_url: Url,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
|
@ -150,7 +150,7 @@ async fn main() -> Result<(), Error> {
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(web::Data::new(data.clone()))
|
.app_data(web::Data::new(data.clone()))
|
||||||
.wrap(cors)
|
.wrap(cors)
|
||||||
.service(api::web(&data.config.web.base_path))
|
.service(api::web())
|
||||||
})
|
})
|
||||||
.bind((web.ip, web.port))?
|
.bind((web.ip, web.port))?
|
||||||
.run()
|
.run()
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ impl EmailToken {
|
||||||
.execute(&mut conn)
|
.execute(&mut conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let mut verify_endpoint = data.config.web.frontend_url.join("verify-email")?;
|
let mut verify_endpoint = data.config.web.url.join("verify-email")?;
|
||||||
|
|
||||||
verify_endpoint.set_query(Some(&format!("token={}", token)));
|
verify_endpoint.set_query(Some(&format!("token={}", token)));
|
||||||
|
|
||||||
|
@ -1104,7 +1104,7 @@ impl PasswordResetToken {
|
||||||
.execute(&mut conn)
|
.execute(&mut conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let mut reset_endpoint = data.config.web.frontend_url.join("reset-password")?;
|
let mut reset_endpoint = data.config.web.url.join("reset-password")?;
|
||||||
|
|
||||||
reset_endpoint.set_query(Some(&format!("token={}", token)));
|
reset_endpoint.set_query(Some(&format!("token={}", token)));
|
||||||
|
|
||||||
|
@ -1153,7 +1153,7 @@ impl PasswordResetToken {
|
||||||
.get_result(&mut conn)
|
.get_result(&mut conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let login_page = data.config.web.frontend_url.join("login")?;
|
let login_page = data.config.web.url.join("login")?;
|
||||||
|
|
||||||
let email = data
|
let email = data
|
||||||
.mail_client
|
.mail_client
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue