Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
notifications-bot
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
archives
notifications-bot
Commits
bc993c4d
Commit
bc993c4d
authored
Sep 10, 2021
by
Jonah Husson
Browse files
Options
Downloads
Patches
Plain Diff
Easy toggle for apns gateway
parent
4c7d4661
No related branches found
No related tags found
1 merge request
!5
Release
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
cmd/root.go
+1
-0
1 addition, 0 deletions
cmd/root.go
notifications/notifications.go
+10
-2
10 additions, 2 deletions
notifications/notifications.go
with
12 additions
and
2 deletions
README.md
+
1
−
0
View file @
bc993c4d
...
...
@@ -41,5 +41,6 @@ apnsKeyPath: ""
apnsKeyID
:
"
"
apnsIssuer
:
"
"
apnsBundleID
:
"
"
apnsDev
:
true
# === END YAML
```
This diff is collapsed.
Click to expand it.
cmd/root.go
+
1
−
0
View file @
bc993c4d
...
...
@@ -81,6 +81,7 @@ var rootCmd = &cobra.Command{
KeyID
:
viper
.
GetString
(
"apnsKeyID"
),
Issuer
:
viper
.
GetString
(
"apnsIssuer"
),
BundleID
:
viper
.
GetString
(
"apnsBundleID"
),
Dev
:
viper
.
GetBool
(
"apnsDev"
),
},
}
...
...
This diff is collapsed.
Click to expand it.
notifications/notifications.go
+
10
−
2
View file @
bc993c4d
...
...
@@ -52,6 +52,7 @@ type APNSParams struct {
KeyID
string
Issuer
string
BundleID
string
Dev
bool
}
// Local impl for notifications; holds comms, storage object, creds and main functions
...
...
@@ -116,12 +117,19 @@ func StartNotifications(params Params, noTLS, noFirebase bool) (*Impl, error) {
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to read APNS key"
)
}
var
endpoint
apns
.
ClientOption
if
params
.
APNS
.
Dev
{
jww
.
INFO
.
Println
(
""
)
endpoint
=
apns
.
WithEndpoint
(
apns
.
DevelopmentGateway
)
}
else
{
endpoint
=
apns
.
WithEndpoint
(
apns
.
ProductionGateway
)
}
apnsClient
,
err
:=
apns
.
NewClient
(
apns
.
WithJWT
(
apnsKey
,
params
.
APNS
.
KeyID
,
params
.
APNS
.
Issuer
),
apns
.
WithBundleID
(
params
.
APNS
.
BundleID
),
apns
.
WithMaxIdleConnections
(
100
),
apns
.
WithTimeout
(
5
*
time
.
Second
))
apns
.
WithTimeout
(
5
*
time
.
Second
),
endpoint
)
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to setup apns client"
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment