-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathservices.go
More file actions
117 lines (101 loc) · 2.69 KB
/
services.go
File metadata and controls
117 lines (101 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package util
import "os"
const FrontProtocol = "https"
func DockerChecker() bool {
_, ok := os.LookupEnv("DOCKER_ENV_SET_PROD") // dev production environment
_, ok1 := os.LookupEnv("DOCKER_ENV_SET_DEV") // dev front environment
return ok || ok1
}
func GetCrossServiceProtocol() string {
if DockerChecker(){
return "https"
}
return "http"
}
func GetMicroservicesProtocol() string {
if DockerChecker(){
return "https"
}
return "http"
}
func GetFrontProtocol() string {
if DockerChecker(){
return "https"
}
return "http"
}
func GetAuthHostAndPort() (string, string) {
var authHost, authPort = "localhost", "8000" // dev.db environment
if DockerChecker() {
authHost = "auth"
authPort = "8080"
}
return authHost, authPort
}
func GetConnectionHostAndPort() (string, string) {
var connHost, connPort = "localhost", "8085" // dev.db environment
if DockerChecker() {
connHost = "connection"
connPort = "8080"
}
return connHost, connPort
}
func GetProfileHostAndPort() (string, string) {
var profileHost, profilePort = "localhost", "8083" // dev.db environment
if DockerChecker() {
profileHost = "profile"
profilePort = "8080"
}
return profileHost, profilePort
}
func GetPostHostAndPort() (string, string) {
var postHost, postPort = "localhost", "8086" // dev.db environment
if DockerChecker() {
postHost = "post"
postPort = "8080"
}
return postHost, postPort
}
func GetPostReactionHostAndPort() (string, string) {
var postReactionHost, postReactionPort = "localhost", "8087" // dev.db environment
if DockerChecker() {
postReactionHost = "postreaction"
postReactionPort = "8080"
}
return postReactionHost, postReactionPort
}
func GetCampaignHostAndPort() (string, string) {
var campaignHost, campaignPort = "localhost", "8088" // dev.db environment
if DockerChecker() {
campaignHost = "campaign"
campaignPort = "8080"
}
return campaignHost, campaignPort
}
func GetFrontHostAndPort() (string, string) {
var frontHost, frontPort = "localhost", "3000"
if DockerChecker() {
frontPort = "81"
}
return frontHost, frontPort
}
func GetGatewayHostAndPort() (string, string) {
var gatewayHost, gatewayPort = "localhost", "81"
return gatewayHost, gatewayPort
}
func GetMonitoringHostAndPort() (string, string) {
var monitoringHost, monitoringPort = "localhost", "8089" // dev.db environment
if DockerChecker() {
monitoringHost = "monitoring"
monitoringPort = "8080"
}
return monitoringHost, monitoringPort
}
func GetNotificationHostAndPort() (string, string) {
var notificationHost, notificationPort = "localhost", "8090" // dev.db environment
if DockerChecker() {
notificationHost = "notification"
notificationPort = "8080"
}
return notificationHost, notificationPort
}