Skip to content

Validate Trino, auth and query configuration - #431

Draft
Bohreromir wants to merge 3 commits into
mainfrom
fix-402-config-validation
Draft

Bohreromir wants to merge 3 commits into
mainfrom
fix-402-config-validation

Conversation

@Bohreromir

Copy link
Copy Markdown
Member

Description

closes #402

Docs

Release note

Checklist

Author

  • AI review done, findings addressed
  • Tests added or updated
  • Changelog updated (if the repo keeps one)

Reviewer

  • Useful comments and logging
  • Docs added or updated per the style guide

Acceptance

  • Check for release notes and docs

Validates an http or https URL from an environment variable, treating a blank value as unset. Used by the Trino and OIDC settings in the following commits (#402).
STACKABLE_COCKPIT_TRINO_AUTH_TYPE, _TRINO_TLS_INSECURE, _TRINO_USER_IMPERSONATION, _QUERY_TTL and the Trino URLs fell back to defaults on invalid input, so a typo could silently disable TLS verification or impersonation. They are now parsed once at startup, and invalid values stop the server with an error naming each variable.
OIDC was silently disabled when only some of STACKABLE_COCKPIT_OIDC_DISCOVERY_URL, _CLIENT_ID and _CLIENT_SECRET were set. Setting only some of them now stops the server at startup, and the discovery URL must be an http or https URL.
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 67.31% 9109 / 13532
🔵 Statements 66.29% 12273 / 18513
🔵 Functions 68.14% 2944 / 4320
🔵 Branches 57.32% 5144 / 8974
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/hooks.server.ts 0% 0% 0% 0% 23-147
src/lib/env-schema.ts 100% 100% 100% 100%
src/lib/server/auth.ts 70.58% 33.33% 54.54% 77.77% 13, 14, 15, 18, 120-143
src/lib/server/trino/client.ts 63.01% 59.67% 53.33% 68.75% 80, 81, 93-94, 114-115, 132-142, 156, 166, 191-197, 229-230, 236, 270-279
src/lib/server/trino/config.ts 100% 100% 100% 100%
src/lib/server/trino/queries.ts 100% 94.33% 100% 100%
Generated in workflow #1212 for commit ac76567 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add zod validation for Trino, auth and query settings

1 participant