Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
de9d173
issue certificates for gateway
t-aleksander Jan 14, 2026
3382c67
remove gw tokens, cleanup
t-aleksander Jan 14, 2026
5f51eb6
cleanup
t-aleksander Jan 14, 2026
2f8a147
clippy
t-aleksander Jan 14, 2026
85ab322
sqlx prepare
t-aleksander Jan 14, 2026
e5e73ee
consts
t-aleksander Jan 14, 2026
f87c198
update protobufs
t-aleksander Jan 14, 2026
a4f8736
Merge branch 'dev' of https://github.com/DefGuard/defguard into compo…
t-aleksander Jan 16, 2026
4816598
proxy wizard backend
t-aleksander Jan 25, 2026
ce7a13e
proxy wizard frontend
t-aleksander Jan 25, 2026
8876f37
remove eprintln
t-aleksander Jan 26, 2026
a41bf2f
Merge branch 'dev' of https://github.com/DefGuard/defguard into proxy…
t-aleksander Jan 26, 2026
4231d19
fix lint
t-aleksander Jan 26, 2026
c563a7d
fix
t-aleksander Jan 26, 2026
b27f047
fix 2
t-aleksander Jan 26, 2026
e993c70
gateway wizard 1
t-aleksander Jan 26, 2026
dbb2266
fix domain validator
t-aleksander Jan 27, 2026
def828f
fixes, gateway names, navigation
t-aleksander Jan 27, 2026
8f6a96d
Merge branch 'dev' of https://github.com/DefGuard/defguard into gatew…
t-aleksander Jan 27, 2026
62fb4ed
routetree
t-aleksander Jan 27, 2026
41fe958
fix frontend
t-aleksander Jan 27, 2026
3493970
after merge fix
t-aleksander Jan 27, 2026
36d2f1b
proto update
t-aleksander Jan 27, 2026
2e97e1f
fix linters
t-aleksander Jan 27, 2026
c93dab1
Merge branch 'dev' of https://github.com/DefGuard/defguard into gatew…
t-aleksander Jan 27, 2026
6d4f6b0
fix sqlx fixtures
t-aleksander Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/defguard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ dotenvy = "0.15"
secrecy = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
11 changes: 7 additions & 4 deletions crates/defguard/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ use tokio::sync::{
broadcast,
mpsc::{channel, unbounded_channel},
};
use tracing_subscriber::util::SubscriberInitExt;

#[macro_use]
extern crate tracing;
Expand All @@ -61,11 +62,13 @@ async fn main() -> Result<(), anyhow::Error> {
.set(config.clone())
.expect("Failed to initialize server config.");

// initialize tracing with version formatter
defguard_version::tracing::init(
defguard_version::Version::parse(VERSION)?,
let subscriber = tracing_subscriber::registry();
defguard_version::tracing::with_version_formatters(
&defguard_version::Version::parse(VERSION)?,
&config.log_level,
)?;
subscriber,
)
.init();

info!("Starting ... version v{VERSION}");
debug!("Using config: {config:?}");
Expand Down
16 changes: 15 additions & 1 deletion crates/defguard_common/src/db/models/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct Gateway<I = NoId> {
pub has_certificate: bool,
pub certificate_expiry: Option<NaiveDateTime>,
pub version: Option<String>,
pub name: String,
}

impl<I> Gateway<I> {
Expand All @@ -34,7 +35,7 @@ impl<I> Gateway<I> {

impl Gateway {
#[must_use]
pub fn new<S: Into<String>>(network_id: Id, url: S) -> Self {
pub fn new<S: Into<String>>(network_id: Id, url: S, name: S) -> Self {
Self {
id: NoId,
network_id,
Expand All @@ -45,6 +46,7 @@ impl Gateway {
has_certificate: false,
certificate_expiry: None,
version: None,
name: name.into(),
}
}
}
Expand Down Expand Up @@ -120,6 +122,18 @@ impl Gateway<Id> {

Ok(())
}

// TODO: Split the URL into address and port fields just like in proxy
pub async fn find_by_url<'e, E>(executor: E, url: &str) -> Result<Option<Self>, sqlx::Error>
where
E: PgExecutor<'e>,
{
let record = query_as!(Self, "SELECT * FROM gateway WHERE url = $1", url)
.fetch_optional(executor)
.await?;

Ok(record)
}
}

impl fmt::Display for Gateway<Id> {
Expand Down
Loading
Loading