Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Introduce env to configure-aspen.py
Browse files Browse the repository at this point in the history
On #2226 I added a wireup._env function and used it under the hood in
wireup to replace some older code. This commit brings configure-aspen
into the mix. By introducing the env object into configure-aspen I'm
setting us up to replace os.environ calls in other wireup functions with
the env object.
  • Loading branch information
chadwhitacre committed Apr 2, 2014
1 parent 99df134 commit acec1f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
5 changes: 4 additions & 1 deletion configure-aspen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from aspen import log_dammit


# Wireup Algorithm
# ================

Expand All @@ -36,12 +37,14 @@
}


env = gittip.wireup.env()
gittip.wireup.canonical()
website.db = gittip.wireup.db()
gittip.wireup.billing()
gittip.wireup.username_restrictions(website)
gittip.wireup.nanswers()
gittip.wireup.envvars(website)
gittip.wireup.accounts_elsewhere(website, env)
gittip.wireup.other_stuff(website, env)
tell_sentry = gittip.wireup.make_sentry_teller(website)

# The homepage wants expensive queries. Let's periodically select into an
Expand Down
13 changes: 3 additions & 10 deletions gittip/wireup.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,7 @@ class BadEnvironment(SystemExit):
pass


def envvars(website):
env = _env()


# Accounts Elsewhere
# ==================
def accounts_elsewhere(website, env):

twitter = Twitter(
website.db,
Expand Down Expand Up @@ -205,9 +200,7 @@ def envvars(website):
website.platforms = AccountElsewhere.platforms = PlatformRegistry(all_platforms)


# Other Stuff
# ===========

def other_stuff(website, env):
website.asset_version_url = env.gittip_asset_version_url.replace('%version', website.version)
website.asset_url = env.gittip_asset_url
website.cache_static = env.gittip_cache_static
Expand All @@ -221,7 +214,7 @@ def envvars(website):
website.log_metrics = env.log_metrics


def _env():
def env():
env = Environment(
DATABASE_URL = unicode,
CANONICAL_HOST = unicode,
Expand Down

0 comments on commit acec1f8

Please sign in to comment.