Compare commits
No commits in common. "d7232a53efab7acd5d9ba3bc378ccd42defc7add" and "09f61eb64d07c852011e54b1eeec02374e3922a5" have entirely different histories.
d7232a53ef
...
09f61eb64d
14
.env.example
14
.env.example
@ -2,9 +2,6 @@
|
|||||||
PORT=7123
|
PORT=7123
|
||||||
HOST=127.0.0.1
|
HOST=127.0.0.1
|
||||||
|
|
||||||
#AfricasTalking USSD POST endpoint
|
|
||||||
AT_ENDPOINT=/ussd/africastalking
|
|
||||||
|
|
||||||
#PostgreSQL
|
#PostgreSQL
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_USER=postgres
|
DB_USER=postgres
|
||||||
@ -15,7 +12,10 @@ DB_SSLMODE=disable
|
|||||||
DB_TIMEZONE=Africa/Nairobi
|
DB_TIMEZONE=Africa/Nairobi
|
||||||
|
|
||||||
#External API Calls
|
#External API Calls
|
||||||
CUSTODIAL_URL_BASE=http://localhost:5003
|
CREATE_ACCOUNT_URL=http://localhost:5003/api/v2/account/create
|
||||||
CUSTODIAL_BEARER_TOKEN=eyJeSIsInRcCI6IkpXVCJ.yJwdWJsaWNLZXkiOiIwrrrrrr
|
TRACK_STATUS_URL=https://custodial.sarafu.africa/api/track/
|
||||||
DATA_URL_BASE=http://localhost:5006
|
BALANCE_URL=https://custodial.sarafu.africa/api/account/status/
|
||||||
DATA_BEARER_TOKEN=eyJeSIsIRcCI6IXVCJ.yJwdWJsaLZXkiOiIwrrrrrr
|
TRACK_URL=http://localhost:5003/api/v2/account/status
|
||||||
|
|
||||||
|
#AfricasTalking USSD POST endpoint
|
||||||
|
AT_ENDPOINT=/ussd/africastalking
|
||||||
|
@ -19,8 +19,8 @@ const (
|
|||||||
var (
|
var (
|
||||||
custodialURLBase string
|
custodialURLBase string
|
||||||
dataURLBase string
|
dataURLBase string
|
||||||
CustodialBearerToken string
|
CustodialAPIKey string
|
||||||
DataBearerToken string
|
DataAPIKey string
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -38,8 +38,8 @@ func setBase() error {
|
|||||||
|
|
||||||
custodialURLBase = initializers.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003")
|
custodialURLBase = initializers.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003")
|
||||||
dataURLBase = initializers.GetEnv("DATA_URL_BASE", "http://localhost:5006")
|
dataURLBase = initializers.GetEnv("DATA_URL_BASE", "http://localhost:5006")
|
||||||
CustodialBearerToken = initializers.GetEnv("CUSTODIAL_BEARER_TOKEN", "")
|
CustodialAPIKey = initializers.GetEnv("CUSTODIAL_API_KEY", "xd")
|
||||||
DataBearerToken = initializers.GetEnv("DATA_BEARER_TOKEN", "")
|
DataAPIKey = initializers.GetEnv("DATA_API_KEY", "xd")
|
||||||
|
|
||||||
_, err = url.JoinPath(custodialURLBase, "/foo")
|
_, err = url.JoinPath(custodialURLBase, "/foo")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -209,13 +209,13 @@ func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKRespons
|
|||||||
}
|
}
|
||||||
|
|
||||||
func doCustodialRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
func doCustodialRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
||||||
req.Header.Set("Authorization", "Bearer "+config.CustodialBearerToken)
|
req.Header.Set("X-GE-KEY", config.CustodialAPIKey)
|
||||||
logRequestDetails(req)
|
logRequestDetails(req)
|
||||||
return doRequest(ctx, req, rcpt)
|
return doRequest(ctx, req, rcpt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func doDataRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
func doDataRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
||||||
req.Header.Set("Authorization", "Bearer "+config.DataBearerToken)
|
req.Header.Set("X-GE-KEY", config.DataAPIKey)
|
||||||
logRequestDetails(req)
|
logRequestDetails(req)
|
||||||
return doRequest(ctx, req, rcpt)
|
return doRequest(ctx, req, rcpt)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user