Extract SSL cert logic into testable setup-ssl.sh script#1637
Merged
Conversation
- Move cert generation and validation from docker-entrypoint.sh to setup-ssl.sh - Accept CERT_DIR and HOST as environment variables - Use absolute paths with CERT_DIR instead of cd + relative paths - Use portable sed pattern matching instead of hardcoded line numbers - Preserve existing behavior including known bugs (duplicate rootCA.crt check) - Add 7 tests documenting current behavior including bug test case
5 tasks
arseny-kostenko
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extract the SSL certificate generation and validation logic from
docker-entrypoint.shinto a standalonesetup-ssl.shscript so it can be tested in isolation, following the same pattern used forprocess-environment.sh.setup-ssl.sh, parameterized byCERT_DIRandHOSTenvironment variablesCERT_DIRinstead ofcd+ relative pathssedpattern matching instead of hardcoded line numbers (necessary for cross-platform test execution)rootCA.crtcheck that missesserver.key)chmod a+x ./setup-ssl.shto DockerfileThis is a behavior-preserving extraction to enable a follow-up PR that fixes the bugs with test coverage already in place.
Validation
pnpm checkspassespnpm testpasses (7 new tests insetup-ssl.test.ts)rootCA.crt/ missingserver.keydefectexit 1due to missingset -eindocker-entrypoint.sh, silently falls back to HTTP. This is pre-existing behavior preserved by this PR and will be fixed in a follow-up.Related Issues
Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.