[pull] master from angristan:master#105
Merged
Merged
Conversation
) ## Summary - Eliminate all CHOICE intermediary variables (~17 variables removed) - Replace numeric values with descriptive string values throughout - Centralize configuration defaults in a single function - Add comprehensive validation for all configuration values - Add reusable helper functions for interactive prompts - Fix non-interactive mode to skip interactive prompts entirely ## Changes ### Configuration Values Now Use Strings | Variable | Before | After | |----------|--------|-------| | TLS_SIG | 1, 2, 3 | "crypt-v2", "crypt", "auth" | | CERT_TYPE | 1, 2 | "ecdsa", "rsa" | | DNS | 1-13 | "cloudflare", "quad9", "custom", etc. | ### Code Reduction - Removed ~80 lines of duplicate defaults from `installOpenVPN()` - Removed ~60 lines of CHOICE variable assignments from `cmd_install()` - Net change: cleaner structure with better separation of concerns ### New Functions - `set_installation_defaults()`: Single source of truth for all defaults - `validate_configuration()`: Validates all config values after defaults applied - `select_from_array()`: Generic menu selection helper - `select_with_labels()`: Menu with display labels different from values - `prompt_yes_no()`: Yes/no prompts with validation - `prompt_validated()`: Custom value prompts with validation function - `detect_server_ips()`: Detects server IPv4/IPv6 addresses - `prepare_network_config()`: Calculates derived network config (gateways, etc.) ### Configuration Constants Added readonly arrays for valid options: - `PROTOCOLS`, `DNS_PROVIDERS`, `CIPHERS`, `CERT_TYPES` - `CERT_CURVES`, `RSA_KEY_SIZES`, `TLS_VERSIONS` - `TLS13_CIPHERSUITES_OPTIONS`, `TLS_GROUPS_OPTIONS` - `HMAC_ALGORITHMS`, `TLS_SIG_MODES` ### Non-Interactive Mode Fix - `installQuestions()` is now only called in interactive mode - IP detection and gateway calculations extracted to separate functions - Renamed `AUTO_INSTALL` to `NON_INTERACTIVE_INSTALL` for clarity - Non-interactive installs no longer hang waiting for user input ## Test plan - [ ] Run `make test` (default Ubuntu) - [ ] Test interactive installation - [ ] Test non-interactive installation with CLI flags - [ ] Test non-interactive installation with environment variables - [ ] Test invalid configuration values are rejected
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )