Skip to content

Conversation

StealthBadger747
Copy link
Contributor

Add File-Based Configuration Support

This PR adds support for loading sensitive configuration values from files, improving security and integration with system credential management.

Changes

  • Added *_path variables for sensitive configuration values:
    • pre_authkey_path,
    • client_secret_path,
    • headscale_api_key_path,
    • cookie_secret_path,
  • Enhanced config loader to support environment variable interpolation in paths
  • Added comprehensive tests for the new configuration system

Testing

Added test suite in tests/config.test.js to verify the new configuration system.

Differences vs #213

I think is is a much simpler implementation, less changes to the arktype structures and less supporting code and other weirdness.


Tagging @igor-ramazanov

@StealthBadger747 StealthBadger747 mentioned this pull request Jul 30, 2025
exclude: ['node_modules/**', 'build/**'],
setupFiles: ['./tests/setupOverlayFs.js'],
},
resolve: {
Copy link
Owner

Choose a reason for hiding this comment

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

Any chance this can "just work" with vite and the tsconfigPaths plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can probably play around with it and see. There was a reason why I did it, but it's possible it's not needed anymore.

@tale
Copy link
Owner

tale commented Aug 1, 2025

Overall this is very solid stuff, once you address the review I'll merge this in and then Nix 🔥

@igor-ramazanov
Copy link
Contributor

@StealthBadger747 You can drop these Nix commits as I've extracted them into: #282:

  1. d260309 (#283)
  2. 2245f5b (#283)
  3. b41f3fe (#283)

Also, you can drop the nix/package.nix diff from the first commit for the same reason: e9c7bcd (#283)

After that the PR will have only TypeScript changes.

@StealthBadger747
Copy link
Contributor Author

Ah, the nix stuff snuck in 😅, I made this PR while jet lagged. I'll clean it up later today

StealthBadger747 and others added 2 commits August 5, 2025 10:10
Got the build working

Maybe actually fix builds

Copy drizzle as well
Revert flake.nix and package.nix to main; drop wasm.nix
@StealthBadger747 StealthBadger747 force-pushed the erikp/implement-path-loading-round-2 branch from 16e549a to d7e62bd Compare August 5, 2025 05:10
@StealthBadger747
Copy link
Contributor Author

Unfortunately I do not have time to play around with vitest.config.ts today, but I have removed the nix changes from this PR.

@tale
Copy link
Owner

tale commented Aug 5, 2025

That's ok, I'll merge it in for now

@tale tale merged commit 5ab9686 into tale:next Aug 5, 2025
2 of 3 checks passed
@tale tale mentioned this pull request Aug 5, 2025
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.

3 participants