get it to work on the server with docker

This commit is contained in:
OMGeeky
2023-10-29 19:36:30 +01:00
parent f92a6e3248
commit d26c4ebad4
8 changed files with 154 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ impl<USER: EasyString> CustomFlowDelegate<USER> {
}
}
impl<USER: EasyString> InstalledFlowDelegate for CustomFlowDelegate<USER> {
#[tracing::instrument]
#[tracing::instrument(skip(self))]
fn redirect_uri(&self) -> Option<&str> {
if !(&crate::CONF.google.local_auth_redirect) {
let url = "https://game-omgeeky.de:7443/googleapi/auth";
@@ -48,7 +48,7 @@ impl<USER: EasyString> InstalledFlowDelegate for CustomFlowDelegate<USER> {
}
}
impl<USER: EasyString> CustomFlowDelegate<USER> {
#[tracing::instrument]
#[tracing::instrument(skip(self, url, need_code))]
async fn present_user_url(&self, url: &str, need_code: bool) -> StdResult<String, String> {
let user: String = self
.user
@@ -114,6 +114,10 @@ async fn get_auth_code() -> Result<String> {
break;
}
println!(
"sleeping for {} second before trying again",
crate::CONF.google.auth_file_read_timeout
);
tokio::time::sleep(tokio::time::Duration::from_secs(
crate::CONF.google.auth_file_read_timeout,
))

View File

@@ -11,6 +11,19 @@ pub mod prelude;
lazy_static! {
pub(crate) static ref CONF: Conf = Conf::builder()
.env()
.file(
std::env::var("TWBA_CONFIG")
.map(|v| {
dbg!(&v);
info!("using {} as primary config source after env", v);
v
})
.unwrap_or_else(|x| {
dbg!(x);
error!("could not get config location from env");
"./settings.toml".to_string()
})
)
.file("./settings.toml")
.file(shellexpand::tilde("~/twba/config.toml").into_owned())
.load()
@@ -39,7 +52,7 @@ async fn run() -> Result<()> {
let x = &CONF.google;
debug!("{:?}", x);
trace!("creating db-connection");
trace!("creating db-connection with db url: {}", &CONF.db_url);
let db = local_db::open_database(Some(&CONF.db_url)).await?;
trace!("migrating db");
local_db::migrate_db(&db).await?;