NAME

ASP4::Config - Central configuration for ASP4

SYNOPSIS

# Settings:
$Config->system->settings->some_setting;
$Config->system->settings->another_setting;

# Error-handling:
$Config->errors->error_handler;
$Config->errors->mail_errors_to;
$Config->errors->mail_errors_from;
$Config->errors->smtp_server;

# Web:
$Config->web->application_name;
$Config->web->application_root;
$Config->web->project_root;
$Config->web->www_root;
$Config->web->handler_root;
$Config->web->media_manager_upload_root;
$Config->web->page_cache_root;

# Data Connections:
foreach my $conn ( map { $Config->data_connections->$_ } qw/ session application main / )
{
  my $dbh = DBI->connect(
    $conn->dsn,
    $conn->username,
    $conn->password
  );
}# end foreach()

JSON Config File

ASP4::ASP keeps all of its configuration inside of /conf/asp4-config.json

Here is an example:

{
  "system": {
    "post_processors": [
      
    ],
    "libs": [
      "@ServerRoot@/lib",
      "@ProjectRoot@/lib"
    ],
    "load_modules": [
      "DBI",
      "DBD::SQLite"
    ],
    "env_vars": {
      "myvar":        "Some-Value",
      "another_var":  "Another Value"
    },
    "settings": {
      "foo": "bar",
      "baz": "bux"
    }
  },
  "errors": {
    "error_handler":    "ASP4::ErrorHandler",
    "mail_errors_to":   "you@yours.com",
    "mail_errors_from": "root@localhost",
    "smtp_server":      "localhost"
  },
  "web": {
    "application_name": "DefaultApp",
    "application_root": "@ServerRoot@",
    "www_root":         "@ServerRoot@/htdocs",
    "handler_root":     "@ServerRoot@/handlers",
    "page_cache_root":  "/tmp/PAGE_CACHE",
    "handler_resolver": "ASP4::HandlerResolver",
    "handler_runner":   "ASP4::HandlerRunner",
    "filter_resolver":  "ASP4::FilterResolver",
    "request_filters": [
      {
        "uri_match":  "^/.*",
        "class":      "My::Filter"
      }
    ],
    "disable_persistence": [
      {
        "uri_match":            "^/handlers/dev\\.speed",
        "disable_session":      true
      },
      {
        "uri_match":            "^/index\\.asp",
        "disable_session":      true
      }
    ]
  },
  "data_connections": {
    "session": {
      "manager":          "ASP4::SessionStateManager",
      "cookie_name":      "session-id",
      "cookie_domain":    ".mysite.com",
      "session_timeout":  30,
      "dsn":              "DBI:SQLite:dbname=/tmp/db_asp4",
      "username":         "",
      "password":         ""
    },
    "main": {
      "dsn":      "DBI:SQLite:dbname=/tmp/db_asp4",
      "username": "",
      "password": ""
    }
  }
}

BUGS

It's possible that some bugs have found their way into this release.

Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=ASP4 to submit bug reports.

HOMEPAGE

Please visit the ASP4 homepage at http://0x31337.org/code/ to see examples of ASP4 in action.

AUTHOR

John Drago <jdrago_999@yahoo.com>

COPYRIGHT

Copyright 2008 John Drago. All rights reserved.

LICENSE

This software is Free software and is licensed under the same terms as perl itself.