diff --git a/start.sh b/start.sh index 66b6ed3..e80ec05 100644 --- a/start.sh +++ b/start.sh @@ -1,22 +1,22 @@ #!/bin/bash set -e -# Check if the configuration file already exists -if [ -f /frpc.toml ]; then - echo "/frpc.toml already exists, skipping creation." -else - # Only create a config file if HP_SHARED_KEY is set. - if [ -n "$HP_SHARED_KEY" ]; then - echo "HP_SHARED_KEY is set, creating /frpc.toml configuration file..." - if [ -d "/certs/frp" ]; then - echo "Found /certs/frp directory. Creating configuration with TLS certificates." - cat < /frpc.toml +# Only create a config file if HP_SHARED_KEY is set. +if [ -n "$HP_SHARED_KEY" ]; then + echo "HP_SHARED_KEY is set, creating /frpc.toml configuration file..." + if [ -d "/certs/frp" ]; then + echo "Found /certs/frp directory. Creating configuration with TLS certificates." + cat < /frpc.toml serverAddr = "$HP_FRP_ADDRESS" serverPort = $HP_FRP_PORT -metadatas.token = "$HP_SHARED_KEY" + +transport.tls.enable = true transport.tls.certFile = "/certs/frp/client.crt" transport.tls.keyFile = "/certs/frp/client.key" transport.tls.trustedCaFile = "/certs/frp/ca.crt" +transport.tls.serverName = "harp.nc" + +metadatas.token = "$HP_SHARED_KEY" [[proxies]] name = "$APP_ID" @@ -25,11 +25,14 @@ localIP = "127.0.0.1" localPort = $APP_PORT remotePort = $APP_PORT EOF - else - echo "Directory /certs/frp not found. Creating configuration without TLS certificates." - cat < /frpc.toml + else + echo "Directory /certs/frp not found. Creating configuration without TLS certificates." + cat < /frpc.toml serverAddr = "$HP_FRP_ADDRESS" serverPort = $HP_FRP_PORT + +transport.tls.enable = false + metadatas.token = "$HP_SHARED_KEY" [[proxies]] @@ -39,10 +42,9 @@ localIP = "127.0.0.1" localPort = $APP_PORT remotePort = $APP_PORT EOF - fi - else - echo "HP_SHARED_KEY is not set. Skipping FRP configuration." fi +else + echo "HP_SHARED_KEY is not set. Skipping FRP configuration." fi # If we have a configuration file and the shared key is present, start the FRP client