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