Skip to content

Commit

Permalink
Init new env variable in __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
kabusag committed Apr 12, 2021
1 parent ee370b8 commit ad941d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
from apscheduler.triggers.cron import CronTrigger
from flask import Flask

from githubapp import GitHubApp, DirectoryClient, CRON_INTERVAL, TEST_MODE
from githubapp import GitHubApp, DirectoryClient, CRON_INTERVAL, TEST_MODE, ADD_MEMBER

app = Flask(__name__)
github_app = GitHubApp(app)
directory = DirectoryClient()
addUserAsMember = os.getenv('ADD_MEMBER', 'False') == 'True'

# Schedule a full sync
scheduler = BackgroundScheduler(daemon=True)
Expand Down Expand Up @@ -182,7 +181,7 @@ def execute_sync(org, team, slug, state):
else:
for user in state["action"]["add"]:
# Validate that user is in org
if org.is_member(user) or addUserAsMember:
if org.is_member(user) or ADD_MEMBER:
try:
print(f"Adding {user} to {slug}")
team.add_or_update_membership(user)
Expand Down
2 changes: 2 additions & 0 deletions githubapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@
rootlogger.warn('TEST_MODE should be set to "true" or "false"')
rootlogger.warn(e)
TEST_MODE = False
# Check if should add member to organization
ADD_MEMBER = os.getenv("ADD_MEMBER", "False") == "True"

0 comments on commit ad941d2

Please sign in to comment.