Skip to content

Commit

Permalink
remove twilio_dev env variables since the app still depends on loadin…
Browse files Browse the repository at this point in the history
…g vanilla twilio credentials (look at the configuration in top of app.py)
  • Loading branch information
JackWink committed Sep 20, 2014
1 parent 6eccff0 commit 0705b5d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
7 changes: 4 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import random
import urlparse
import json
import os

from datetime import datetime, timedelta

Expand Down Expand Up @@ -181,7 +182,7 @@ def call_user():
to=params['userPhone'],
from_=random.choice(campaign['numbers']),
url=full_url_for("connection", **params),
if_machine='Hangup' if campaign.get('call_human_check') else None,
if_machine='Hangup' if campaign.get('call_human_check') else None,
timeLimit=app.config['TW_TIME_LIMIT'],
timeout=app.config['TW_TIMEOUT'],
status_callback=full_url_for("call_complete_status", **params))
Expand Down Expand Up @@ -221,7 +222,7 @@ def connection():

if campaign.get('skip_star_confirm'):
resp.redirect(url_for('_make_calls', **params))

return str(resp)

action = url_for("_make_calls", **params)
Expand Down Expand Up @@ -296,7 +297,7 @@ def make_single_call():
params['call_index'] = i

if "SPECIAL_CALL_" in params['repIds'][i]:

special = json.loads(params['repIds'][i].replace("SPECIAL_CALL_", ""))
to_phone = special['number']
full_name = special['name']
Expand Down
8 changes: 2 additions & 6 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import twilio.rest


class Config(object):
DEBUG = True

Expand All @@ -13,8 +12,8 @@ class Config(object):
APPLICATION_ROOT = 'http://1cf55a5a.ngrok.com'

TW_CLIENT = twilio.rest.TwilioRestClient(
os.environ.get('TWILIO_DEV_ACCOUNT_SID'),
os.environ.get('TWILIO_DEV_AUTH_TOKEN'))
os.environ.get('TWILIO_ACCOUNT_SID'),
os.environ.get('TWILIO_AUTH_TOKEN'))

TASKFORCE_KEY = os.environ.get('TASKFORCE_KEY')
SUNLIGHTLABS_KEY = os.environ.get('SUNLIGHTLABS_KEY')
Expand Down Expand Up @@ -43,9 +42,6 @@ class ConfigProduction(Config):

APPLICATION_ROOT = os.environ.get('APPLICATION_ROOT')

TW_CLIENT = twilio.rest.TwilioRestClient(
os.environ.get('TWILIO_ACCOUNT_SID'),
os.environ.get('TWILIO_AUTH_TOKEN'))

SECRET_KEY = os.environ.get('SECRET_KEY')

Expand Down
10 changes: 9 additions & 1 deletion fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ def run(env=None):
print("[Warning] No environment specified.")
env = DEVELOPMENT_ENV

env = str(env)

if env != DEVELOPMENT_ENV and env != PRODUCTION_ENV:
print("[Warning] Invalid environment specified, use {} or {}.".format(
DEVELOPMENT_ENV, PRODUCTION_ENV))
env = DEVELOPMENT_ENV

create_env()
print("[Info] Running {} environment.".format(env))
if env is DEVELOPMENT_ENV:
if env == DEVELOPMENT_ENV:
virtualenv("python app.py", env)
else:
virtualenv("foreman start", env)
Expand Down Expand Up @@ -137,6 +144,7 @@ def generate_env_command_prefix(env=None):
continue
export_str += "{}={} ".format(variable.upper(), env_variables[variable])

export_str += "ENV={} ".format(env)
return export_str

def parse_config(section):
Expand Down

0 comments on commit 0705b5d

Please sign in to comment.