Compare commits
2 commits
c6e3fa3eee
...
e48f74b970
Author | SHA1 | Date | |
---|---|---|---|
e48f74b970 | |||
39163ab050 |
8 changed files with 115 additions and 2 deletions
|
@ -1,3 +1,19 @@
|
||||||
|
// Identity. Store your memories and mental belongings
|
||||||
|
// Copyright (C) 2024 Sofía Aritz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use crate::env;
|
use crate::env;
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
// Identity. Store your memories and mental belongings
|
||||||
|
// Copyright (C) 2024 Sofía Aritz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use diesel::{SqliteConnection, r2d2::{ConnectionManager, PooledConnection}, RunQueryDsl, QueryDsl, SelectableHelper, ExpressionMethods, OptionalExtension};
|
use diesel::{SqliteConnection, r2d2::{ConnectionManager, PooledConnection}, RunQueryDsl, QueryDsl, SelectableHelper, ExpressionMethods, OptionalExtension};
|
||||||
use crate::database::models::User;
|
use crate::database::models::User;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
// Identity. Store your memories and mental belongings
|
||||||
|
// Copyright (C) 2024 Sofía Aritz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use axum::{async_trait, extract::FromRequestParts, http::{header::AUTHORIZATION, request::Parts, StatusCode}};
|
use axum::{async_trait, extract::FromRequestParts, http::{header::AUTHORIZATION, request::Parts, StatusCode}};
|
||||||
use tracing::{warn, error};
|
use tracing::{warn, error};
|
||||||
use crate::database::{actions, models::User};
|
use crate::database::{actions, models::User};
|
||||||
|
|
|
@ -1 +1,17 @@
|
||||||
|
// Identity. Store your memories and mental belongings
|
||||||
|
// Copyright (C) 2024 Sofía Aritz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
pub mod auth;
|
pub mod auth;
|
|
@ -1,2 +1,18 @@
|
||||||
|
// Identity. Store your memories and mental belongings
|
||||||
|
// Copyright (C) 2024 Sofía Aritz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
pub mod extractors;
|
pub mod extractors;
|
||||||
pub mod routes;
|
pub mod routes;
|
|
@ -1,3 +1,19 @@
|
||||||
|
// Identity. Store your memories and mental belongings
|
||||||
|
// Copyright (C) 2024 Sofía Aritz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use argon2::{password_hash::{rand_core::OsRng, SaltString}, Argon2, PasswordHash, PasswordHasher, PasswordVerifier};
|
use argon2::{password_hash::{rand_core::OsRng, SaltString}, Argon2, PasswordHash, PasswordHasher, PasswordVerifier};
|
||||||
use axum::{extract::State, http::StatusCode, routing::{get, post, put, delete}, Json, Router};
|
use axum::{extract::State, http::StatusCode, routing::{get, post, put, delete}, Json, Router};
|
||||||
use chrono::{Utc, NaiveDateTime};
|
use chrono::{Utc, NaiveDateTime};
|
||||||
|
|
|
@ -1 +1,17 @@
|
||||||
|
// Identity. Store your memories and mental belongings
|
||||||
|
// Copyright (C) 2024 Sofía Aritz
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
pub mod auth;
|
pub mod auth;
|
|
@ -17,7 +17,7 @@
|
||||||
use axum::{extract::{MatchedPath, Request}, response::Response, routing::get, Router};
|
use axum::{extract::{MatchedPath, Request}, response::Response, routing::get, Router};
|
||||||
use database::create_connection_pool;
|
use database::create_connection_pool;
|
||||||
use diesel::{r2d2::ConnectionManager, SqliteConnection};
|
use diesel::{r2d2::ConnectionManager, SqliteConnection};
|
||||||
use env::LoadEnvError;
|
use env::{listen_port, LoadEnvError};
|
||||||
use http::routes::auth::auth_router;
|
use http::routes::auth::auth_router;
|
||||||
use r2d2::Pool;
|
use r2d2::Pool;
|
||||||
use tower_http::{classify::ServerErrorsFailureClass, trace::TraceLayer};
|
use tower_http::{classify::ServerErrorsFailureClass, trace::TraceLayer};
|
||||||
|
@ -101,7 +101,8 @@ async fn main() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
|
// FIXME(sofia): Add an env var to change the bind addr
|
||||||
|
let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", listen_port()))
|
||||||
.await
|
.await
|
||||||
.expect("failed to bind");
|
.expect("failed to bind");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue