Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/common-go/util/supervisor.go
2498 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package util
6
7
import (
8
"fmt"
9
"os"
10
)
11
12
const (
13
// SupervisorPort defines the supervisor listen port
14
SupervisorPort = 22999
15
)
16
17
// SupervisorAddress return the <host>:<port> pair for supervisor.
18
// Custom values can be defined using the environment variable SUPERVISOR_ADDR.
19
func GetSupervisorAddress() string {
20
addr := os.Getenv("SUPERVISOR_ADDR")
21
if addr == "" {
22
addr = fmt.Sprintf("127.0.0.1:%v", SupervisorPort)
23
}
24
25
return addr
26
}
27
28