Part-DB-server icon indicating copy to clipboard operation
Part-DB-server copied to clipboard

Add INITIAL_ADMIN_API_KEY environment variable support

Open rsp2k opened this issue 3 months ago • 4 comments

  • Add configuration parameter for initial admin API key
  • Implement getInitialAdminApiToken() method in AbstractMultiPlatformMigration
  • Create migration to automatically generate admin API token on initial setup

rsp2k avatar Sep 07 '25 14:09 rsp2k

What is your use case for this? I don't have much of a problem with such a feature, but I never thought that having an API key from the start would be useful?

And maybe a console command to programmatically create API keys would be more useful than doing that in the database migration ?

jbtronics avatar Sep 19 '25 07:09 jbtronics

I'm using it to bootstrap servers while testing. Thank you so much for this absolutely wonderful project! Hats off to you sir!

rsp2k avatar Sep 19 '25 07:09 rsp2k

What would you say about restricting the lifetime of the API token to a week (or even just a day)? That should be enough for testing and bootstrapping applications and should improve security, as you do not risk unauthorized access, if you somehow forget this token or its secret get leaked.

Also I would not put the env into the docker-env templates. That is an feature for advanced usecases, and if you put it into the docker-compose file, then it will probably stay there forever, risking it to be leaked somehow...

jbtronics avatar Sep 23 '25 18:09 jbtronics

Codecov Report

:x: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 56.21%. Comparing base (14cc0b9) to head (f9e7fb4). :warning: Report is 98 commits behind head on master.

Files with missing lines Patch % Lines
src/Migration/AbstractMultiPlatformMigration.php 0.00% 11 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1027      +/-   ##
============================================
- Coverage     56.25%   56.21%   -0.05%     
- Complexity     6663     6667       +4     
============================================
  Files           548      548              
  Lines         21698    21709      +11     
============================================
- Hits          12207    12204       -3     
- Misses         9491     9505      +14     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Sep 23 '25 18:09 codecov[bot]