This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
82 lines (66 loc) · 2.14 KB
/
config.go
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
package main
import (
"golang.org/x/net/context"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
"github.com/migore/paypal"
)
var (
ProductionAppID = "api-getunseen"
StagingAppID = "staging-api-getunseen"
)
func ProductionConfig() Config {
config := Config {
RawBaseUrl: "http://helpmehelp-dot-api-getunseen.appspot.com",
BaseURL: "https://apps.facebook.com/helpmehelp",
PaypalClientId: "ATRub8NK5m1iZV1EFPcs2Ad_lcKx6A7yasQaRSj6wdjKEDPBpzZ1UZBUr4qQtxg45fG-zO8OlZ85fJx4",
PaypalSecret: "EF4fNq7M9l_VztubdFCLsTsUnqGAoSj12WTnGWuguyQKisAC2aneCVNuXDAusmwE5EjDit67YYTMev3z",
PaypalBase: paypal.APIBaseLive,
ExperienceProfileId: "XP-H5BE-78MM-5XMU-LZDX",
}
return config
}
func StagingConfig() Config {
config := Config {
RawBaseUrl: "http://helpmehelp-dot-staging-api-getunseen.appspot.com",
BaseURL: "https://apps.facebook.com/helpmehelp-staging",
PaypalClientId: "AUGtRDBDZek5V-TWQZ4GCALZNfRTbObh5UjxVthXScB90X9W3iDrez2VEVZSFG4qFKDfMsnqPmx7tBze",
PaypalSecret: "EKLTvvNjEHZHvcrH2vmdMjNBHg4BO_8S4YBr2MFMSCfFFy9rz-TdFvk9lMe595Xd-y1UMJErjudYhiRP",
PaypalBase: paypal.APIBaseSandBox,
ExperienceProfileId: "XP-3L6B-V2T3-RGFL-2JBZ",
}
return config
}
func DevConfig() Config {
config := Config {
RawBaseUrl: "http://localhost:8080",
BaseURL: "http://localhost:8080",
PaypalClientId: "AUGtRDBDZek5V-TWQZ4GCALZNfRTbObh5UjxVthXScB90X9W3iDrez2VEVZSFG4qFKDfMsnqPmx7tBze",
PaypalSecret: "EKLTvvNjEHZHvcrH2vmdMjNBHg4BO_8S4YBr2MFMSCfFFy9rz-TdFvk9lMe595Xd-y1UMJErjudYhiRP",
PaypalBase: paypal.APIBaseSandBox,
ExperienceProfileId: "XP-3L6B-V2T3-RGFL-2JBZ",
}
return config
}
type Config struct {
RawBaseUrl string
BaseURL string
PaypalClientId string
PaypalSecret string
PaypalBase string
ExperienceProfileId string
}
func NewConfig(context context.Context) Config {
appID := appengine.AppID(context)
log.Infof(context, "AppID: %v", appID)
if appengine.IsDevAppServer() {
return DevConfig()
}
if appID == ProductionAppID {
return ProductionConfig()
}
if appID == StagingAppID {
return StagingConfig()
}
panic("Could not resolve environment configuration")
}