Skip to content

Commit 52edb2e

Browse files
committed
Get web server port from config
1 parent ab2a49c commit 52edb2e

4 files changed

Lines changed: 4 additions & 1 deletion

File tree

config_dev.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
web_server_port = 5000
12
gitopia_grpc_url = "grpc.gitopia.dev:9090"
23
git_dir = "/var/repos"
34
attachment_dir = "/var/attachments"

config_local.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
web_server_port = 5001
12
gitopia_grpc_url = "localhost:9090"
23
git_dir = "/var/repos"
34
attachment_dir = "/var/attachments"

config_prod.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
web_server_port = 5000
12
gitopia_grpc_url = "grpc.gitopia.com:9090"
23
git_dir = "/var/repos"
34
attachment_dir = "/var/attachments"

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ func main() {
11871187
handler := cors.Default().Handler(mux)
11881188

11891189
// Start HTTP server
1190-
if err := http.ListenAndServe(":5000", handler); err != nil {
1190+
if err := http.ListenAndServe(fmt.Sprintf(":%v", viper.GetString("web_server_port")), handler); err != nil {
11911191
log.Fatal(err)
11921192
}
11931193
}

0 commit comments

Comments
 (0)