-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using awk and trim string down to 25 chars to avoid URLs th…
…at are too long.
- Loading branch information
Showing
2 changed files
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
# Convert to lowercase. | ||
str = tolower($0); | ||
# Replace all special chars with hyphens. | ||
gsub(/[^a-z0-9]/, "-", str); | ||
# Deduplicate hyphens. | ||
gsub(/-+/, "-", str); | ||
# Remove leading hyphens. | ||
gsub(/^-/, "", str); | ||
# Trim the string down to 25 characters. | ||
str = substr(str, 0, 25); | ||
# Remove trailing hyphens. | ||
gsub(/-$/, "", str); | ||
# Print out the SetEnvIf line. | ||
printf "SetEnvIf Request_URI \".*\" QA_SUBDOMAIN=%s\n", str | ||
} |