mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 08:25:09 +00:00
fix: some more edge cases
This commit is contained in:
@@ -255,28 +255,40 @@ confirm() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to check if input is IP address
|
||||||
|
is_ip() {
|
||||||
|
local input="$1"
|
||||||
|
[[ "$input" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]
|
||||||
|
}
|
||||||
|
|
||||||
generate_contact_email() {
|
generate_contact_email() {
|
||||||
local domain="$1"
|
local primary_domain="$1"
|
||||||
local email
|
local secondary_domain="$2"
|
||||||
|
local email
|
||||||
|
local domain_to_use
|
||||||
|
|
||||||
if [ -z "$domain" ] || [ "$domain" = "localhost" ] || [[ "$domain" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
# Try primary domain first
|
||||||
email="contact@example.com"
|
if [ -n "$primary_domain" ] && ! is_ip "$primary_domain" && [ "$primary_domain" != "localhost" ]; then
|
||||||
else
|
domain_to_use="$primary_domain"
|
||||||
domain="${domain#http://}"
|
# Try secondary domain if primary is not valid
|
||||||
domain="${domain#https://}"
|
elif [ -n "$secondary_domain" ] && ! is_ip "$secondary_domain" && [ "$secondary_domain" != "localhost" ]; then
|
||||||
domain="${domain%%/*}"
|
domain_to_use="$secondary_domain"
|
||||||
domain="${domain%%\?*}"
|
# Fallback if neither domain is valid
|
||||||
|
else
|
||||||
|
echo "Warning: No valid domain found for SSL certificate email, using example.com. This may cause self-signed certificate errors in production."
|
||||||
|
email="contact@example.com"
|
||||||
|
echo "$email"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$domain" =~ [^.]+\.[^.]+$ ]]; then
|
# Clean up the chosen domain
|
||||||
main_domain="${BASH_REMATCH[0]}"
|
domain_to_use="${domain_to_use#http://}"
|
||||||
else
|
domain_to_use="${domain_to_use#https://}"
|
||||||
main_domain="$domain"
|
domain_to_use="${domain_to_use%%/*}"
|
||||||
fi
|
domain_to_use="${domain_to_use%%\?*}"
|
||||||
|
|
||||||
email="contact@$main_domain"
|
email="contact@$domain_to_use"
|
||||||
fi
|
echo "$email"
|
||||||
|
|
||||||
echo "$email"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_package() {
|
install_package() {
|
||||||
@@ -502,6 +514,7 @@ EOF
|
|||||||
echo -e "${GREEN}✓ Valid domain detected${NC}"
|
echo -e "${GREEN}✓ Valid domain detected${NC}"
|
||||||
print_empty_line
|
print_empty_line
|
||||||
CONFIG_SSL_ENABLED=$(prompt_oneof "Do you want to configure SSL for $CONFIG_DOMAIN_NAME" "Y" "N")
|
CONFIG_SSL_ENABLED=$(prompt_oneof "Do you want to configure SSL for $CONFIG_DOMAIN_NAME" "Y" "N")
|
||||||
|
print_empty_line
|
||||||
if [ "$CONFIG_SSL_ENABLED" = "Y" ]; then
|
if [ "$CONFIG_SSL_ENABLED" = "Y" ]; then
|
||||||
echo -e "${BLUE}→ SSL will be enabled${NC}"
|
echo -e "${BLUE}→ SSL will be enabled${NC}"
|
||||||
else
|
else
|
||||||
@@ -545,6 +558,7 @@ EOF
|
|||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
|
print_empty_line
|
||||||
echo -e "${BLUE}→ Using MinIO domain:${NC} $CONFIG_MINIO_DOMAIN_NAME"
|
echo -e "${BLUE}→ Using MinIO domain:${NC} $CONFIG_MINIO_DOMAIN_NAME"
|
||||||
print_empty_line
|
print_empty_line
|
||||||
|
|
||||||
@@ -552,11 +566,11 @@ EOF
|
|||||||
if [ "$CONFIG_SSL_ENABLED" = "Y" ]; then
|
if [ "$CONFIG_SSL_ENABLED" = "Y" ]; then
|
||||||
if ! is_valid_domain "$CONFIG_MINIO_DOMAIN_NAME"; then
|
if ! is_valid_domain "$CONFIG_MINIO_DOMAIN_NAME"; then
|
||||||
cat << EOF
|
cat << EOF
|
||||||
⚠️ WARNING: Your MinIO domain name is not valid. File attachments will not work with SSL enabled.${NC}
|
⚠️ WARNING: Your MinIO domain name is not valid. File attachments will not work with SSL enabled.
|
||||||
EOF
|
EOF
|
||||||
print_empty_line
|
print_empty_line
|
||||||
if [ "$(prompt_oneof "Would you like to update the MinIO domain name?" "Y" "N")" = "Y" ]; then
|
if [ "$(prompt_oneof "Would you like to update the MinIO domain name?" "Y" "N")" = "Y" ]; then
|
||||||
CONFIG_MINIO_DOMAIN_NAME=$(prompt "Enter a valid domain name for MinIO" "")
|
CONFIG_MINIO_DOMAIN_NAME=$(prompt "Enter a valid domain name for MinIO" "$(get_public_ip)")
|
||||||
echo -e "${BLUE}→ Updated MinIO domain to:${NC} $CONFIG_MINIO_DOMAIN_NAME"
|
echo -e "${BLUE}→ Updated MinIO domain to:${NC} $CONFIG_MINIO_DOMAIN_NAME"
|
||||||
print_empty_line
|
print_empty_line
|
||||||
fi
|
fi
|
||||||
@@ -575,11 +589,13 @@ EOF
|
|||||||
if [ "$CONFIG_MINIO_SSL_ENABLED" = "Y" ]; then
|
if [ "$CONFIG_MINIO_SSL_ENABLED" = "Y" ]; then
|
||||||
echo -e "${BLUE}→ SSL will be enabled for MinIO${NC}"
|
echo -e "${BLUE}→ SSL will be enabled for MinIO${NC}"
|
||||||
else
|
else
|
||||||
|
print_empty_line
|
||||||
echo -e "${BLUE}→ SSL will not be enabled for MinIO${NC}"
|
echo -e "${BLUE}→ SSL will not be enabled for MinIO${NC}"
|
||||||
fi
|
fi
|
||||||
print_empty_line
|
print_empty_line
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
print_empty_line
|
||||||
echo -e "${YELLOW}! Using IP address for MinIO - SSL will not be enabled${NC}"
|
echo -e "${YELLOW}! Using IP address for MinIO - SSL will not be enabled${NC}"
|
||||||
print_empty_line
|
print_empty_line
|
||||||
CONFIG_MINIO_SSL_ENABLED="N"
|
CONFIG_MINIO_SSL_ENABLED="N"
|
||||||
@@ -591,7 +607,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Advanced Configuration
|
# Advanced Configuration
|
||||||
if [ "$(prompt_oneof "Show Advanced Options?" "Y" "N")" = "Y" ]; then
|
if [ "$(prompt_oneof "Show Advanced Options?" "N" "Y")" = "Y" ]; then
|
||||||
print_empty_line
|
print_empty_line
|
||||||
cat << EOF
|
cat << EOF
|
||||||
╔════════════════════════════════════════╗
|
╔════════════════════════════════════════╗
|
||||||
@@ -764,7 +780,7 @@ EOF
|
|||||||
- "--entrypoints.websecure.address=:443"
|
- "--entrypoints.websecure.address=:443"
|
||||||
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
|
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
|
||||||
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
|
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
|
||||||
- "--certificatesresolvers.letsencrypt.acme.email=$(generate_contact_email $CONFIG_DOMAIN_NAME)"
|
- "--certificatesresolvers.letsencrypt.acme.email=$(generate_contact_email "$CONFIG_DOMAIN_NAME" "$CONFIG_MINIO_DOMAIN_NAME")"
|
||||||
- "--certificatesresolvers.letsencrypt.acme.storage=/etc/letsencrypt/acme.json"
|
- "--certificatesresolvers.letsencrypt.acme.storage=/etc/letsencrypt/acme.json"
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user