Skip to content

Commit

Permalink
Integrate processing and PR creation into app
Browse files Browse the repository at this point in the history
  • Loading branch information
penguineer committed May 5, 2022
1 parent 4e8c7d2 commit 15acf3b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import tornado.ioloop

import service
import github
import processor

import logging

Expand All @@ -25,11 +27,6 @@ def make_app(cmt_cfg, comment_cb) -> tornado.web.Application:
])


def cmt_test_cb(cmt: form.Comment):
LOGGER.info("Received comment %s", cmt)
return True


def main():
# Setup logging
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
Expand All @@ -38,6 +35,10 @@ def main():
service_port = os.getenv('SERVICE_PORT', 8080)
cmt_cfg = form.FormConfiguration.from_environment()

# Comment Processor
github_cfg = github.GithubConfiguration.from_environment()
comment_processor = processor.CommentProcessor(github_cfg)

# Setup ioloop
service.platform_setup()
ioloop = tornado.ioloop.IOLoop.current()
Expand All @@ -46,7 +47,7 @@ def main():
# Setup Service Management endpoint
mgmt_ep = service.ServiceEndpoint(listen_port=service_port)
guard.add_termination_handler(mgmt_ep.stop)
app = make_app(cmt_cfg, cmt_test_cb)
app = make_app(cmt_cfg, comment_processor.comment_to_github_pr)
mgmt_ep.setup(app)

# Health Provider map uses weak references, so make sure to store this instance in a variable
Expand Down

0 comments on commit 15acf3b

Please sign in to comment.