Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b42ded93f6 | |||
| dcb4a92afd | |||
| 6b296460dd |
@@ -73,6 +73,7 @@ jobs:
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.IMAGE }}:${{ github.ref_name }}
|
||||
|
||||
@@ -13,6 +13,17 @@ pub async fn init() -> Result<SqlitePool, sqlx::Error> {
|
||||
Ok(pool)
|
||||
}
|
||||
|
||||
pub async fn maybe_seed_demo(pool: &SqlitePool) {
|
||||
if std::env::var("DEMO").as_deref() != Ok("true") {
|
||||
return;
|
||||
}
|
||||
let seed = include_str!("../demo/demo_seed.sql");
|
||||
match sqlx::raw_sql(seed).execute(pool).await {
|
||||
Ok(_) => tracing::info!("DEMO seed applied"),
|
||||
Err(e) => tracing::warn!("DEMO seed failed: {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -29,6 +29,7 @@ async fn main() {
|
||||
}
|
||||
|
||||
let pool = db::init().await.expect("db init failed");
|
||||
db::maybe_seed_demo(&pool).await;
|
||||
|
||||
let static_dir = std::env::var("STATIC_DIR")
|
||||
.unwrap_or_else(|_| "../frontend/build".into());
|
||||
|
||||
@@ -33,6 +33,10 @@ spec:
|
||||
value: {{ .Values.env.DATABASE_URL | quote }}
|
||||
- name: STATIC_DIR
|
||||
value: {{ .Values.env.STATIC_DIR | quote }}
|
||||
{{- range $k, $v := .Values.env.extra }}
|
||||
- name: {{ $k }}
|
||||
value: {{ $v | quote }}
|
||||
{{- end }}
|
||||
- name: JWT_SECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
||||
@@ -39,7 +39,7 @@ httpRoute:
|
||||
hostnames:
|
||||
- tutor.puchstein.dev
|
||||
sectionName: https-tutor-puchstein-dev
|
||||
httpRedirectSectionName: http-tutor-puchstein-dev
|
||||
httpRedirectSectionName: http
|
||||
|
||||
# JWT_SECRET provisioned as a pre-existing K8s Secret named here.
|
||||
# Do not set jwtSecretValue in committed values — provision via kubectl manually.
|
||||
@@ -48,6 +48,9 @@ jwtSecretName: tutortool-jwt
|
||||
env:
|
||||
DATABASE_URL: sqlite:/data/attendance.db
|
||||
STATIC_DIR: /app/frontend/build
|
||||
extra: {}
|
||||
# extra:
|
||||
# DEMO: "true" # seeds demo data on startup (idempotent, INSERT OR IGNORE)
|
||||
|
||||
vpa:
|
||||
enabled: false
|
||||
|
||||
Reference in New Issue
Block a user