Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GO Email Worker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pasan Mallawaarachchi
GO Email Worker
Commits
b10741dd
Commit
b10741dd
authored
Apr 02, 2019
by
Pasan Mallawaarachchi
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
email changes
parent
3b66b248
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
8 deletions
+23
-8
Dockerfile
Dockerfile
+6
-0
config.yaml
config.yaml
+6
-6
docker-compose.yml
docker-compose.yml
+6
-0
worker.go
worker.go
+5
-2
No files found.
Dockerfile
0 → 100644
View file @
b10741dd
FROM
golang:1.12.1-stretch
COPY
./ /go/src/go-with-compose
WORKDIR
/go/src/go-with-compose
RUN
go get github.com/mailgun/mailgun-go
RUN
go get gopkg.in/yaml.v2
CMD
go run worker.go
config.yaml
View file @
b10741dd
couchdb
:
port
:
'
5984'
host
:
0.0.0.0
host
:
bpapi_default
username
:
root
password
:
root
curl
:
check_mail
:
http://root:root@
0.0.0.0
:5984/outbox/_all_docs/?limit=1
#http://root:root@0.0.0.0:5984/outbox/_all_docs/?limit=1
get_outbox_mail
:
http://root:root@
0.0.0.0
:5984/outbox/
delete_outbox_mail
:
http://root:root@
0.0.0.0
:5984/outbox/
add_sent_mail
:
http://root:root@
0.0.0.0
:5984/sentitems/
add_mail_log
:
http://root:root@
0.0.0.0
:5984/mail_logs/
check_mail
:
http://root:root@
bpapi_default
:5984/outbox/_all_docs/?limit=1
#http://root:root@0.0.0.0:5984/outbox/_all_docs/?limit=1
get_outbox_mail
:
http://root:root@
bpapi_default
:5984/outbox/
delete_outbox_mail
:
http://root:root@
bpapi_default
:5984/outbox/
add_sent_mail
:
http://root:root@
bpapi_default
:5984/sentitems/
add_mail_log
:
http://root:root@
bpapi_default
:5984/mail_logs/
protocols
:
method
:
http://
requests
:
...
...
docker-compose.yml
0 → 100644
View file @
b10741dd
version
:
"
2"
services
:
goworker
:
container_name
:
go-worker
restart
:
always
build
:
.
worker.go
View file @
b10741dd
...
...
@@ -139,15 +139,18 @@ func main() {
*/
req
,
reqErr
:=
http
.
NewRequest
(
config
.
Requests
.
Get
,
config
.
Curl
.
CheckMail
,
nil
)
//req, reqErr := http.NewRequest("GET", "http://root:root@0.0.0.0:5984/outbox/_all_docs/?limit=1", nil)
req
.
Header
.
Set
(
config
.
Requests
.
HeaderType
,
config
.
Requests
.
HeaderJson
)
resp
,
respErr
:=
http
.
DefaultClient
.
Do
(
req
)
if
reqErr
!=
nil
{
alert
:=
" Error creating request to OUTBOX DB
\n
"
+
reqErr
.
Error
()
alertAdmin
(
alert
)
panic
(
reqErr
)
}
req
.
Header
.
Set
(
config
.
Requests
.
HeaderType
,
config
.
Requests
.
HeaderJson
)
resp
,
respErr
:=
http
.
DefaultClient
.
Do
(
req
)
if
respErr
!=
nil
{
alert
:=
" Error in getting email from the OUTBOX DB
\n
"
+
respErr
.
Error
()
alertAdmin
(
alert
)
panic
(
respErr
)
}
defer
resp
.
Body
.
Close
()
respbody
,
_
:=
ioutil
.
ReadAll
(
resp
.
Body
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment