#
# AuthKitPak - Pylons development environment configuration
#
# The %(here)s variable will be replaced with the parent directory of this file
#
[DEFAULT]
debug = true
email_to = admin@example.com
smtp_server = smtp.example.com
error_email_from = paste@localhost
## Not needed since we are using smtp
# sendmail = /usr/sbin/sendmail
## Used for account code
method = smtp
## Optional SMTP server username and password
user = xxx
password = secret

[server:main]
use = egg:Paste#http
host = 127.0.0.1
port = 5000

[app:main]
use = egg:{{package}}
cache_dir = %(here)s/data
static_files = true

authkit.use_passurl = true
# passurl_store = sqlite
# passurl_config = sqlite:///%(here)s/openid
passurl_store=file
# passurl_config=file:///%(here)s/data
passurl_config=%(here)s/data

session.key = authk_session_marker_dye
session.secret = somesecret
base_url = http://localhost:5000

# Set the database to use here
# sqlalchemy.url = postgres://user@localhost/consumer_test
sqlalchemy.url = sqlite:///%(here)s/${{package}}.db
sqlalchemy.echo = false

# setup.method = form, cookie
# form.authenticate.user.data = admin:admin 
# cookie.secret = secret string
# 

## Registration Options
use_passurl = true
email_from = James <james@example.com>
password_reminder_subject = Password Reminder
confirm_email_subject = Confirmation
verify_secret = somesecret

# Passurl options (used if use_passurl = true)
# if you don't want these values at all, remove them from the list

# Always needed
sreg.email = required

# Can be optional
sreg.fullname = optional
sreg.nickname = optional
sreg.dob = required
sreg.gender = optional
sreg.postcode = optional
sreg.country = optional
sreg.language = optional
sreg.timezone = optional

authkit.enable = true
authkit.method = forward
authkit.setup.method = forward, form, cookie
authkit.setup.enable = true
# authkit.setup.enable = false
# authkit.setup.fakeuser = admin
authkit.forward.signinpath = /account/signin
# You should change the secret to something else private
authkit.cookie.secret = ${app_instance_secret}
authkit.catch = 403, 401
authkit.cookie.secret = randomisedstring
authkit.cookie.name = __signin
authkit.cookie.params.expires = 20
authkit.cookie.params.secure = False
authkit.cookie.enforce = True
authkit.cookie.includeip = True
authkit.cookie.signoutpath = /auth/signout
authkit.form.authenticate.user.data = admin:admin

# [filter:authkit] 
# paste.filter_app_factory = authkit.authenticate:middleware 
# AuthKit Options

# # Canonical authkit configuration
# 
# # AuthKit configuration ===============================================
# 
# # choose if you want Form or OpenId athentication
# authkit.setup.method = form, cookie
# #authkit.setup.method = openid, cookie
# 
# # choose between the cached version or the normal version
authkit.openid.authenticate.user.type = authkit.users.sqlalchemy_driver:UsersFromDatabase
# authkit.form.authenticate.user.type = authkit.users.sqlalchemy_driver:UsersFromDatabase
# authkit.openid.authenticate.user.type = mapfish.lib.user_auth:CachedUsersFromDatabase
# authkit.form.authenticate.user.type = mapfish.lib.user_auth:CachedUsersFromDatabase
# 
# # General configuration
# # TODO: we should generate a random secret here
# authkit.cookie.secret = xxxxxxxxx
# authkit.cookie.signoutpath = /account/signout
# authkit.cookie.name = myproject-auth
# authkit.cookie.includeip = True
# 
# OpenId configuration
authkit.openid.store.type = file
authkit.openid.store.config = %(here)s/data
authkit.openid.urltouser = authkit.authenticate.open_id:passurl_urltouser
authkit.openid.path.signedin = /account/signedin
authkit.openid.authenticate.user.encrypt = authkit.users:md5
# TODO: we should generate a random secret here
authkit.openid.authenticate.user.encrypt.secret = xxxxxxx
authkit.openid.authenticate.user.data = {{package}}.model
# authkit.openid.template.obj = authk.lib.template:make_openid_template

# # Form configuration
# authkit.form.authenticate.user.encrypt = authkit.users:md5
# # TODO: we should generate a random secret here
# authkit.form.authenticate.user.encrypt.secret = xxxxxxxxxx
# authkit.form.authenticate.user.data = authk.model
# # authkit.form.template.obj = authk.lib.template:make_template


# Base URL (used to overwrite the auto generated value)
# base_url = http://localhost:5000

# If you'd like to fine-tune the individual locations of the cache data dirs
# for Myghty, the Cache data, or the Session saves, un-comment the desired
# settings here:
#myghty_data_dir = %(here)s/data/templates
#cache_data_dir = %(here)s/data/cache
#session_data_dir = %(here)s/data/sessions

# Specify the database for SQLObject to use via pylons.database.PackageHub.
# %(here) may include a ':' character on Windows environments; this can
# invalidate the URI when specifying a SQLite db via path name. Refer to the
# SQLObject documentation for a special syntax to preserve the URI.
#sqlobject.dburi = sqlite:%(here)s/somedb.db

# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
# Debug mode will enable the interactive debugging tool, allowing ANYONE to
# execute malicious code after an exception is raised.
#set debug = false

# Logging configuration
[loggers]
keys = root, routes, {{package_logger}}{{if sqlalchemy}}, sqlalchemy{{endif}}

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_routes]
level = INFO
handlers =
qualname = routes.middleware
# "level = DEBUG" logs the route matched and routing variables.

[logger_{{package_logger}}]
level = DEBUG
handlers =
qualname = {{package_logger}}

{{if sqlalchemy}}

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither.  (Recommended for production systems.)
{{endif}}

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S


# Chainsaw Logging configuration
# [loggers]
# keys = root, routes, {{package_logger}}{{if sqlalchemy}}, sqlalchemy{{endif}}
# 
# [handlers]
# keys = chainsaw
# 
# [formatters]
# keys = generic, xmllayout
# 
# [logger_root]
# level = NOTSET
# handlers = chainsaw
# 
# [logger_routes]
# level = NOTSET
# handlers = chainsaw
# qualname = routes.middleware
# # "level = DEBUG" logs the route matched and routing variables.

# [logger_{{package}}]
# level = NOTSET
# handlers = chainsaw
# propagate = 1
# qualname = bel
# 
# [handler_console]
# class = StreamHandler
# args = (sys.stderr,)
# level = INFO
# formatter = generic
# 
# [logger_sqlalchemy]
# level = INFO
# handlers = chainsaw
# qualname = sqlalchemy.engine
# # "level = INFO" logs SQL queries.
# # "level = DEBUG" logs SQL queries and results.
# # "level = WARN" logs neither.  (Recommended for production systems.)
# 
# [handler_chainsaw]
# class = xmllayout.RawSocketHandler
# args = ('localhost', 4448)
# level = NOTSET
# formatter = xmllayout
# 
# [formatter_generic]
# format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
# datefmt = %H:%M:%S
# 
# [formatter_xmllayout]
# class = xmllayout.XMLLayout

