make it clear when you are in test setting
This commit is contained in:
parent
a32d393836
commit
a9e4714a60
@ -1,5 +1,11 @@
|
||||
# Stationslauf
|
||||
|
||||
## Demo-Instance
|
||||
|
||||
- [startest.it-results.at](https://startest.it-results.at)
|
||||
- DB resets on every commit/deployment
|
||||
- Default admin: "a"/"123"
|
||||
|
||||
## Marketing
|
||||
- single-binary (+ db + .env)
|
||||
- Teams werden automatisch (start)stationen zugewiesen
|
||||
|
@ -30,7 +30,7 @@ use maud::{html, Markup};
|
||||
use partials::page;
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use std::sync::Arc;
|
||||
use std::{env, sync::Arc};
|
||||
use tokio::net::TcpListener;
|
||||
use tower_sessions::{cookie::time::Duration, Expiry, Session, SessionManagerLayer};
|
||||
use tower_sessions_sqlx_store_chrono::SqliteStore;
|
||||
@ -41,6 +41,10 @@ pub(crate) mod models;
|
||||
mod partials;
|
||||
pub(crate) mod station;
|
||||
|
||||
pub(crate) fn test_version() -> bool {
|
||||
env::var("TEST_VERSION").is_ok()
|
||||
}
|
||||
|
||||
pub(crate) fn pl(amount: usize, single: &str, append: &str) -> String {
|
||||
if amount == 1 {
|
||||
single.into()
|
||||
|
@ -16,6 +16,8 @@ async fn main() {
|
||||
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||
let db: SqlitePool = PoolOptions::new().connect(&database_url).await.unwrap();
|
||||
|
||||
// Test
|
||||
|
||||
// Axum
|
||||
let port = env::var("PORT").expect("PORT must be set");
|
||||
let listener = tokio::net::TcpListener::bind(&format!("0.0.0.0:{port}"))
|
||||
|
@ -1,4 +1,5 @@
|
||||
use maud::{DOCTYPE, Markup, html};
|
||||
use crate::test_version;
|
||||
use maud::{html, Markup, DOCTYPE};
|
||||
use tower_sessions::Session;
|
||||
|
||||
pub(crate) async fn page(content: Markup, session: Session, leaflet: bool) -> Markup {
|
||||
@ -26,6 +27,22 @@ pub(crate) async fn page(content: Markup, session: Session, leaflet: bool) -> Ma
|
||||
@if leaflet {
|
||||
link rel="stylesheet" href="/leaflet.css";
|
||||
}
|
||||
@if test_version() {
|
||||
style {
|
||||
r#"
|
||||
body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
background: repeating-linear-gradient(
|
||||
45deg,
|
||||
rgba(0, 0, 0, 0.3),
|
||||
rgba(0, 0, 0, 0.3) 20px,
|
||||
rgba(255, 255, 0, 0.3) 20px,
|
||||
rgba(255, 255, 0, 0.3) 40px
|
||||
);
|
||||
}"#
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
main class="container" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user