General utilities used by the RaceHub team.
Here's the Leiningen dependency:
You know what to do.
- CDN: Amazon Cloudfront
- Storage: Amazon S3
- Session Store: Redis - clj-redis-session and Carmine.
- Database: CouchDB - Clutch
- GEONAMES_KEY - To get current timezone, in location.cljx.
- DEFAULT_TIMEZONE - For time.cljx.
- COUCH_URL - Url for your CouchDB.
- DATABASE_NAME - Database name of your CouchDB.
- COUCH_VIEW_DIRECTORY - Where your CouchDB views live.
- COUCH_VIEW_SUFFIX - If you use different view names in production and staging.
- REDIS_URL - Url of your redis service.
- SESSION_STORE - Or :redis by default.
- CRYPTO_KEY - For Base 64 encoding/decoding.
- FB_APP_SECRET
- FB_CLIENT_ID
- FB_CLIENT_SERVICE
Semigroup protocol with 'plus' implementation - gives you monoids for cljs and clj to "add" maps or vectors.
Utilities for managing image uploads to Amazon's S3, and Cloudfront CDN.
Schemas and helper functions related to CouchDB: connecting, creating/deleting/updating documents or attachments, getting documents, querying views, and some helpers for marking the creation or update timestamps for a document, and other utility functions.
Environmental Variables: COUCH_URL, DATABASE_NAME, COUCH_VIEW_SUFFIX (We use different views for production and staging, so we can experiment with new views before doing a production release.)
Google Locations API
Common schemas that we use in our projects, and helper functions such as 'toggle-optional'
clj-time helpers. Include convenience functions for creating timestamps, computing intervals, conversions between various time formats, timezone changes, etc.
A smorgasbord of helper functions for clj and cljs, spanning accounting, Enlive, core.async, form validation, map and vector operations, time/date manipulation, string formatting, and more.
Common validators we use, including some Validateur helpers.
Functions for controlling the lifecycle of an application, deprecating in favor of Component
Functions for managing our Redis session store. Configuration using the REDIS_URL environmental variable, cache expiration, etc.
defdbtest is a macro that we use to test our CouchDB Views. You'll need to setup Erica in order for this to work. You should pass in a vector of design-docs to use with the :required-views option. Make sure that you have a COUCH_URL environmental variable (see CouchDB.cljx above). The macro creates a test database on your current CouchDB, binds the database to test-database for the duration of the body, creates the required views in the test database via Erica, evaluates all the tests in the body, and then deletes the test database and returns to your original db configuration.
If the request starts with "www.", strips it from the request, and forces a permanent (301) redirect. (We use a "bare" domain).
Injects a :config key into the request, with :mode, :dev?, and :cdn keys.
Injects a :uuid into each request; useful for logging purposes. TODO: We don't have to heroku-request-id anymore. (Just generates a random one, which is fine).
Some of our forms have a "_method" keyword so our Liberator endpoints can process DELETE requests.
Stores all the app config details in env. Helpers to get environmental keys as keyword or boolean; convenience macros like with-env
to execute code with the supplied config. For service configurations, we use the same environmental variables in production and development, but the production ones have a "PROD_" prefix. We supply a prefixed
macro to execute code with with given keys and prefix.
Encryption and decryption.
Wrapper for Facebook Auth. Needs FB environmental keys mentioned at the top.
Helpers for authentication and authorization using Friend. Removing and merging authentications, login helpers, and 'spy-mode', which allows us to see what a given logged in user would see.
TODO.
Helpers for our liberator resource management. Some base resources for form endpoints (for validation), media type negotiation, and merging resources.
Logging helpers for Timbre. Adds in the action, uuid, uri, and current-user into the log. We define log/info, log/error, etc (same as in timbre), but have each of the previously mentioned keywords merge in for each logger.
Helpers for performing oauth. We define liberator resources for the initial handshake, token exchange, and unlinking.
Ring helpers for various redirects, and extracting access tokens or referrers from request maps.
Helpers to add a success! or error! message to the flash.
- Sam Ritchie https://twitter.com/sritchie
- Dave Petrovics https://github.com/dpetrovics
Copyright © 2014 PaddleGuru LLC.
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.