Skip to content

feat: make config file a stable feature#897

Open
steveiliop56 wants to merge 1 commit into
mainfrom
feat/config-file
Open

feat: make config file a stable feature#897
steveiliop56 wants to merge 1 commit into
mainfrom
feat/config-file

Conversation

@steveiliop56
Copy link
Copy Markdown
Member

@steveiliop56 steveiliop56 commented May 24, 2026

Summary by CodeRabbit

  • New Features
    • Added database driver configuration option with SQLite support
    • Introduced authentication attributes and ACL policy settings
    • Added label provider auto-detection configuration
    • Added server concurrency listener settings
    • Introduced Tailscale integration configuration block with multiple options

Review Change Stack

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 24, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2026

📝 Walkthrough

Walkthrough

This PR promotes experimental file configuration to stable status by moving ConfigFile from ExperimentalConfig to the top-level Config struct, updates the file loader to use standard flag and environment variable names instead of experimental variants, and expands .env.example with new configuration options for database driver, server concurrency, enhanced authentication attributes, ACL policies, label providers, and Tailscale integration.

Changes

Experimental file configuration promotion and config expansion

Layer / File(s) Summary
Config model structure (non-experimental ConfigFile)
internal/model/config.go
ConfigFile is promoted from ExperimentalConfig to the top-level Config struct with YAML-ignored marking. ExperimentalConfig is simplified to an empty struct, and default config initialization no longer sets up the Experimental section.
File loader implementation (standard config paths)
internal/utils/loaders/loader_file.go
File loader defaults switch from experimental naming (traefik.experimental.configfile / TINYAUTH_EXPERIMENTAL_CONFIGFILE) to standard names (traefik.configfile / TINYAUTH_CONFIGFILE). Experimental warning log is removed and the corresponding zerolog/log import is dropped.
Environment template configuration options
.env.example
Database driver selection, server concurrent listener toggle, expanded auth user attributes (name, email, address, locale, timezone), ACL policy default ("allow"), label provider auto-detection, and complete Tailscale integration block (enabled, state directory, hostname, auth key, ephemeral node settings) are added to the configuration template.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • tinyauthapp/tinyauth#647: Both PRs modify the .env.example configuration template, adding and reworking templated environment keys and defaults for Tinyauth.

Poem

🐰 The experimental flags now shine so bright,
Promoted to stable, promoted to light!
Database drivers, Tailscale's embrace,
Configuration blooms—a more graceful place.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: make config file a stable feature' directly and clearly describes the main objective of the changeset: promoting the config file functionality from experimental to stable status.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/config-file

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/utils/loaders/loader_file.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/utils/loaders/loader_file.go (1)

21-29: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep legacy env-var fallback to avoid silent config-file disablement.

Line 22 drops TINYAUTH_EXPERIMENTAL_CONFIGFILE; setups still using it now hit the return false, nil path and won’t load the file config.

Proposed compatibility patch
 	// I guess we are using traefik as the root name (we can't change it)
 	configFileFlag := "traefik.configfile"
 	envVar := "TINYAUTH_CONFIGFILE"
+	legacyEnvVar := "TINYAUTH_EXPERIMENTAL_CONFIGFILE"

 	if _, ok := flags[configFileFlag]; !ok {
-		if value := os.Getenv(envVar); value != "" {
+		value := os.Getenv(envVar)
+		if value == "" {
+			value = os.Getenv(legacyEnvVar)
+		}
+		if value != "" {
 			flags[configFileFlag] = value
 		} else {
 			return false, nil
 		}
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/utils/loaders/loader_file.go` around lines 21 - 29, The code in
loader_file.go currently only checks TINYAUTH_CONFIGFILE (envVar) when
populating flags[configFileFlag], which causes setups using the legacy
TINYAUTH_EXPERIMENTAL_CONFIGFILE to fall through and return false; fix this by
adding a fallback check for the legacy env var
(TINYAUTH_EXPERIMENTAL_CONFIGFILE) before returning, i.e., when value :=
os.Getenv(envVar) is empty then check
os.Getenv("TINYAUTH_EXPERIMENTAL_CONFIGFILE") and if present assign that to
flags[configFileFlag] so the existing loadConfig behavior (in the surrounding
function that uses configFileFlag) continues to work for legacy users.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@internal/utils/loaders/loader_file.go`:
- Around line 21-29: The code in loader_file.go currently only checks
TINYAUTH_CONFIGFILE (envVar) when populating flags[configFileFlag], which causes
setups using the legacy TINYAUTH_EXPERIMENTAL_CONFIGFILE to fall through and
return false; fix this by adding a fallback check for the legacy env var
(TINYAUTH_EXPERIMENTAL_CONFIGFILE) before returning, i.e., when value :=
os.Getenv(envVar) is empty then check
os.Getenv("TINYAUTH_EXPERIMENTAL_CONFIGFILE") and if present assign that to
flags[configFileFlag] so the existing loadConfig behavior (in the surrounding
function that uses configFileFlag) continues to work for legacy users.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 22c6e51f-8e81-414c-8523-c9e6e36ecf3b

📥 Commits

Reviewing files that changed from the base of the PR and between c346113 and 748768d.

📒 Files selected for processing (3)
  • .env.example
  • internal/model/config.go
  • internal/utils/loaders/loader_file.go

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

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants