-
-
Couldn't load subscription status.
- Fork 46
Introduce armbian-config config file to store app wide variables #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,13 +27,15 @@ function module_swag() { | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| case "$1" in | ||||||||||||||||||||||||||||
| "${commands[0]}") | ||||||||||||||||||||||||||||
| SWAG_URL=$(dialog --title \ | ||||||||||||||||||||||||||||
| SWAG_URL=$($DIALOG --title \ | ||||||||||||||||||||||||||||
| "Secure Web Application Gateway URL?" \ | ||||||||||||||||||||||||||||
| --inputbox "\nExamples: myhome.domain.org (port 80 and 443 must be exposed to internet)" \ | ||||||||||||||||||||||||||||
| 8 80 "" 3>&1 1>&2 2>&3); | ||||||||||||||||||||||||||||
| 8 80 "${DOMAIN}" 3>&1 1>&2 2>&3); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| if [[ ${SWAG_URL} && $? -eq 0 ]]; then | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Comment on lines
+30
to
36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t use $? after command substitution; capture dialog exit status explicitly. Using $? here tests the assignment, not the dialog’s result. This will treat “Cancel”/ESC as success if the input is non-empty. Capture the rc immediately. Apply this diff: - SWAG_URL=$($DIALOG --title \
+ SWAG_URL=$($DIALOG --title \
"Secure Web Application Gateway URL?" \
--inputbox "\nExamples: myhome.domain.org (port 80 and 443 must be exposed to internet)" \
- 8 80 "${DOMAIN}" 3>&1 1>&2 2>&3);
-
- if [[ ${SWAG_URL} && $? -eq 0 ]]; then
+ 8 80 "${DOMAIN}" 3>&1 1>&2 2>&3)
+ dialog_rc=$?
+ if [[ ${dialog_rc} -eq 0 && -n "${SWAG_URL}" ]]; then📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| # save to configuration file | ||||||||||||||||||||||||||||
| set_config_var "DOMAIN" "${SWAG_URL}" "$CONFIG_FILE" | ||||||||||||||||||||||||||||
| # adjust hostname | ||||||||||||||||||||||||||||
|
Comment on lines
+37
to
39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Normalize to a bare host before persisting DOMAIN. Users may enter “https://example.com”, which would store a scheme in DOMAIN. Persist the host only to keep config consistent and to match SWAG’s expected URL semantics. Apply this diff: - # save to configuration file
- set_config_var "DOMAIN" "${SWAG_URL}" "$CONFIG_FILE"
+ # Normalize and save domain (strip scheme/path/port)
+ DOMAIN_HOST="$(printf '%s' "${SWAG_URL}" | sed -E 's@^[[:space:]]*([A-Za-z][A-Za-z0-9+.-]*://)?([^/:]+).*$@\2@')"
+ # save to configuration file
+ set_config_var "DOMAIN" "${DOMAIN_HOST}" "$CONFIG_FILE"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| hostnamectl set-hostname $(echo ${SWAG_URL} | sed -E 's/^\s*.*:\/\///g') | ||||||||||||||||||||||||||||
| # install docker | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix editorconfig failures (tabs vs spaces) and harden set_config_var (escape value; atomic write).
Apply this diff to address CI and robustness:
Also ensure the file ends with a single trailing newline to satisfy editorconfig.
📝 Committable suggestion
🧰 Tools
🪛 GitHub Actions: Coding style check
[error] 130-132: editorconfig-checker: Wrong indentation type(spaces instead of tabs)
[error] 134-140: editorconfig-checker: Wrong indentation type(spaces instead of tabs)
🤖 Prompt for AI Agents