Skip to content
This repository was archived by the owner on Jan 2, 2026. It is now read-only.

Commit 0577a21

Browse files
committed
feat: create issuer entry in db on startup
creates an entry for the domainname used by this instance on startup.
1 parent 9e69a7f commit 0577a21

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/main.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* A robust, performant polyproto home server.
1111
*/
1212

13-
use std::{path::PathBuf, str::FromStr};
13+
use std::{path::PathBuf, process::exit, str::FromStr};
1414

1515
use clap::Parser;
1616
use log::{LevelFilter, debug, error, info, trace};
@@ -44,6 +44,7 @@ pub(crate) use crate::errors::{StdError, StdResult};
4444
use crate::{
4545
crypto::ed25519::DigitalSignature,
4646
database::{
47+
Issuer,
4748
algorithm_identifier::AlgorithmIdentifier,
4849
api_keys::{self, ApiKey},
4950
tokens::TokenStore,
@@ -155,6 +156,19 @@ async fn main() -> StdResult<()> {
155156
_ => error!("Could not manipulate database: {e:?}"),
156157
},
157158
};
159+
debug!("Inserting own issuer domain name into the database...");
160+
match Issuer::create_own(&database).await {
161+
Ok(i) => match i {
162+
Some(issuer) => {
163+
debug!(r#"Inserted own issuer "{}" into the database!"#, issuer.domain_components)
164+
}
165+
None => debug!("Issuer entry already present, nothing changed"),
166+
},
167+
Err(e) => {
168+
error!("Could not manipulate database: {e:?}");
169+
exit(5)
170+
}
171+
}
158172

159173
let token_store = TokenStore::new(database.clone());
160174

0 commit comments

Comments
 (0)