Merge remote-tracking branch 'remote/master' into feature/add-xml-support-to-http-monitors

pull/2610/head
Faruk Genç 2 years ago
commit 7dacc6a002

@ -11,12 +11,17 @@ import (
"net/http" "net/http"
"os" "os"
"runtime" "runtime"
"strings"
"time" "time"
) )
func main() { func main() {
isFreeBSD := runtime.GOOS == "freebsd" isFreeBSD := runtime.GOOS == "freebsd"
// Is K8S + uptime-kuma as the container name
// See #2083
isK8s := strings.HasPrefix(os.Getenv("UPTIME_KUMA_PORT"), "tcp://")
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; // process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{ http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{
InsecureSkipVerify: true, InsecureSkipVerify: true,
@ -44,7 +49,11 @@ func main() {
hostname = "127.0.0.1" hostname = "127.0.0.1"
} }
port := os.Getenv("UPTIME_KUMA_PORT") port := ""
// UPTIME_KUMA_PORT is override by K8S unexpectedly,
if !isK8s {
port = os.Getenv("UPTIME_KUMA_PORT")
}
if len(port) == 0 { if len(port) == 0 {
port = os.Getenv("PORT") port = os.Getenv("PORT")
} }

@ -19,17 +19,17 @@ if (sslKey && sslCert) {
// If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise. // If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise.
// Dual-stack support for (::) // Dual-stack support for (::)
let hostname = process.env.UPTIME_KUMA_HOST; let hostname = process.env.UPTIME_KUMA_SERVICE_HOST || process.env.UPTIME_KUMA_HOST || "::";
// Also read HOST if not *BSD, as HOST is a system environment variable in FreeBSD // Also read HOST if not *BSD, as HOST is a system environment variable in FreeBSD
if (!hostname && !FBSD) { if (!hostname && !FBSD) {
hostname = process.env.HOST; hostname = process.env.HOST;
} }
const port = parseInt(process.env.UPTIME_KUMA_PORT || process.env.PORT || 3001); const port = parseInt(process.env.UPTIME_KUMA_SERVICE_PORT || process.env.UPTIME_KUMA_PORT || process.env.PORT || 3001);
let options = { let options = {
host: hostname || "127.0.0.1", host: hostname,
port: port, port: port,
timeout: 28 * 1000, timeout: 28 * 1000,
}; };

@ -417,10 +417,6 @@
<div class="my-3"> <div class="my-3">
<tags-manager ref="tagsManager" :pre-selected-tags="monitor.tags"></tags-manager> <tags-manager ref="tagsManager" :pre-selected-tags="monitor.tags"></tags-manager>
</div> </div>
<div class="mt-5 mb-1">
<button id="monitor-submit-btn" class="btn btn-primary" type="submit" :disabled="processing">{{ $t("Save") }}</button>
</div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@ -619,6 +615,10 @@
</template> </template>
</template> </template>
</div> </div>
<div class="col-md-12 mt-5 mb-1">
<button id="monitor-submit-btn" class="btn btn-primary" type="submit" :disabled="processing">{{ $t("Save") }}</button>
</div>
</div> </div>
</div> </div>
</form> </form>

Loading…
Cancel
Save