###
# app configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###

[app:main]
use = egg:make_post_sell

pyramid.reload_templates = true
pyramid.debug_authorization = true
pyramid.debug_notfound = true
pyramid.debug_routematch = true
pyramid.default_locale_name = en
pyramid.includes = pyramid_debugtoolbar pyramid_tm

# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
#debugtoolbar.hosts = 127.0.0.1 ::1
debugtoolbar.hosts = 0.0.0.0/0

sqlalchemy.url = sqlite:///%(here)s/make_post_sell.sqlite

retry.attempts = 3

###
# session / cookie configuration.
# http://docs.pylonsproject.org/docs/pyramid/en/latest/api/session.html
###
session.hashalg = sha512
session.secret  = test-secret
session.timeout = 31104000
session.max_age = 31104000
session.reissue_time = 15552000
session.secure = false
#session.domain = localhost.localhost
session.domain = localhost
session.samesite = Lax

###
# app "business logic" settings
###

# Root domain for make_post_sell
app.make_post_sell.root_domain = ${MAKE_POST_SELL_ROOT_DOMAIN:-localhost}

# Root URL for make_post_sell
app.make_post_sell.root_url = ${MAKE_POST_SELL_ROOT_URL:-http://localhost:6501}

# Optional: Email for the root domain owner
app.make_post_sell.root_domain_owner_email = ${MAKE_POST_SELL_DOMAIN_OWNER_EMAIL:-changeme@example.com}

# app.email.relay = localhost:8025

# Single warm sending identity for ALL transactional mail (OTP codes, receipts,
# sale/offer notifications, gift cards, invites) — regardless of which shop or
# custom domain it's for. origin.makepostsell.com is DKIM-signed (d=makepostsell.com)
# and SPF-authorized (relayed via mx1.foxhop.net). See docs/tickets/mps-23.md.
# The shop name (when in shop context) becomes the From display name; this is the
# fallback display name for platform mail with no shop context.
app.email.sender = ${MPS_EMAIL_SENDER:-no-reply@origin.makepostsell.com}
app.email.from_name = ${MPS_EMAIL_FROM_NAME:-Make Post Sell}

# TODO: these values should be moved to environment variables & we should create an
# example app.env environment file.
app.bucket.secure_uploads = ${MPS_APP_MAIN_BUCKET}
app.bucket.secure_uploads.region = nyc3
app.bucket.secure_uploads.post_endpoint = https://nyc3.digitaloceanspaces.com
app.bucket.secure_uploads.get_endpoint = https://plan-period-files.nyc3.cdn.digitaloceanspaces.com
app.bucket.secure_uploads.access_key = ${MPS_APP_SECURE_UPLOADS_ACCESS_KEY}
app.bucket.secure_uploads.secret_key = ${MPS_APP_SECURE_UPLOADS_SECRET_KEY}


# stripe test mode is enabled for development & disabled by default.
app.stripe.test_mode = True

# PayPal sandbox mode is enabled for development & disabled by default.
app.paypal.sandbox_mode = ${MPS_PAYPAL_SANDBOX_MODE:-True}
app.paypal.webhook_id = ${MPS_PAYPAL_WEBHOOK_ID:-}

# Payment method toggles
app.payments.stripe.enabled = ${MPS_PAYMENTS_STRIPE_ENABLED:-True}
app.payments.paypal.enabled = ${MPS_PAYMENTS_PAYPAL_ENABLED:-True}
app.payments.monero.enabled = ${MPS_PAYMENTS_MONERO_ENABLED:-False}
app.payments.dogecoin.enabled = ${MPS_PAYMENTS_DOGECOIN_ENABLED:-False}
app.payments.adyen.enabled = ${MPS_PAYMENTS_ADYEN_ENABLED:-True}

# Feature toggles
app.features.popout_player.enabled = ${MPS_FEATURES_POPOUT_PLAYER_ENABLED:-True}

# Karaoke (MPS-18) and torrent (MPS-19) — off by default until fixed.
# Flip to True only when the feature works end-to-end. See MPS-22.
app.features.karaoke.enabled = ${MPS_FEATURES_KARAOKE_ENABLED:-False}
app.features.torrent.enabled = ${MPS_FEATURES_TORRENT_ENABLED:-False}

# Adyen Configuration (test mode for development)
app.adyen.test_mode = ${MPS_ADYEN_TEST_MODE:-True}

# Monero RPC Configuration
# RPC endpoint of monero-wallet-rpc (recommend binding to localhost only)
monero.rpc_url = ${MPS_MONERO_RPC_URL:-http://127.0.0.1:18083/json_rpc}
monero.rpc_user = ${MPS_MONERO_RPC_USER:-test_user}
monero.rpc_pass = ${MPS_MONERO_RPC_PASS:-test_pass}
monero.account_index = ${MPS_MONERO_ACCOUNT_INDEX:-0}
# Monero confirmation requirements by amount tier
# Note: Payment thresholds are now per-shop settings (default $10 and $100)
monero.confirmations.petty = ${MPS_MONERO_CONFIRMATIONS_PETTY:-2}
monero.confirmations.mid = ${MPS_MONERO_CONFIRMATIONS_MID:-10}
monero.confirmations.high = ${MPS_MONERO_CONFIRMATIONS_HIGH:-20}
monero.quote_expiry_seconds = ${MPS_MONERO_QUOTE_EXPIRY_SECONDS:-900}
monero.rate_source_url = ${MPS_MONERO_RATE_SOURCE_URL:-https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=usd}

# Dogecoin RPC Configuration
# RPC endpoint of dogecoind (recommend binding to localhost only)
dogecoin.rpc_url = ${MPS_DOGECOIN_RPC_URL:-http://127.0.0.1:22555}
dogecoin.rpc_user = ${MPS_DOGECOIN_RPC_USER:-mps_doge_user}
dogecoin.rpc_pass = ${MPS_DOGECOIN_RPC_PASS:-change_this_password_in_production}
# Dogecoin confirmation requirements by amount tier
# Note: Payment thresholds are now per-shop settings (default $10 and $100)
dogecoin.confirmations.petty = ${MPS_DOGECOIN_CONFIRMATIONS_PETTY:-2}
dogecoin.confirmations.mid = ${MPS_DOGECOIN_CONFIRMATIONS_MID:-6}
dogecoin.confirmations.high = ${MPS_DOGECOIN_CONFIRMATIONS_HIGH:-20}
# Fee buffer for customer payments (in DOGE) - reduced from 0.01 to 0.002 for more reasonable fees
dogecoin.fee_buffer = ${MPS_DOGECOIN_FEE_BUFFER:-0.002}
dogecoin.rate_source_url = ${MPS_DOGECOIN_RATE_SOURCE_URL:-https://api.coingecko.com/api/v3/simple/price?ids=dogecoin&vs_currencies=usd}

# set this to the path of your private DKIM key.
# reference: https://russell.ballestrini.net/quickstart-to-dkim-signed-email-with-python/
#app.email.dkim_private_key_path = ${MPS_APP_DKIM_PRIVATE_KEY_PATH}
#app.email.dkim_selector = ${MPS_APP_DKIM_SELECTOR}

# choices: rsa-sha256 or ed25519-sha256
#app.email.dkim_signature_algorithm = ed25519-sha256

# optionally overload the saas logo with a custom one.
#app.saas_logo = /static/memopoly.png
#app.saas_theme_color = #c50008ff
# optional ribbon text.
#app.saas_ribbon_text = setup shop in this virtual meme market world game! 
app.saas_ribbon_text = Sell the digital things you make — commission free! open source, public domain, ecommerce software!

[pshell]
setup = make_post_sell.scripts.pshell.setup

###
# wsgi server configuration
###

[alembic]
# path to migration scripts
script_location = make_post_sell:scripts/alembic
sqlalchemy.url = sqlite:///%(here)s/make_post_sell.sqlite

[server:main]
use = egg:waitress#main
#listen = localhost:6501
listen = 0.0.0.0:6501

###
# logging configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###

[loggers]
keys = root, make_post_sell, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_make_post_sell]
level = DEBUG
handlers =
qualname = make_post_sell

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

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

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
