Skip to content

Commit ed141af

Browse files
committed
Initial commit
0 parents  commit ed141af

30 files changed

+868
-0
lines changed

.dancer

Whitespace-only changes.

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sessions*
2+

bin/app.psgi

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env perl
2+
3+
use strict;
4+
use warnings;
5+
use FindBin;
6+
use lib "$FindBin::Bin/../lib";
7+
8+
9+
# use this block if you don't need middleware, and only have a single target Dancer app to run here
10+
use DLBlog;
11+
12+
DLBlog->to_app;
13+
14+
=begin comment
15+
# use this block if you want to include middleware such as Plack::Middleware::Deflater
16+
17+
use DLBlog;
18+
use Plack::Builder;
19+
20+
builder {
21+
enable 'Deflater';
22+
DLBlog->to_app;
23+
}
24+
25+
=end comment
26+
27+
=cut
28+
29+
=begin comment
30+
# use this block if you want to mount several applications on different path
31+
32+
use DLBlog;
33+
use DLBlog_admin;
34+
35+
use Plack::Builder;
36+
37+
builder {
38+
mount '/' => DLBlog->to_app;
39+
mount '/admin' => DLBlog_admin->to_app;
40+
}
41+
42+
=end comment
43+
44+
=cut
45+

config.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This is the main configuration file of your Dancer2 app
2+
# env-related settings should go to environments/$env.yml
3+
# all the settings in this file will be loaded at Dancer's startup.
4+
5+
# === Basic configuration ===
6+
7+
# Your application's name
8+
appname: "DLBlog"
9+
10+
# The default layout to use for your application (located in
11+
# views/layouts/main.tt)
12+
layout: "main"
13+
14+
# when the charset is set to UTF-8 Dancer2 will handle for you
15+
# all the magic of encoding and decoding. You should not care
16+
# about unicode within your app when this setting is set (recommended).
17+
charset: "UTF-8"
18+
19+
# === Engines ===
20+
#
21+
# NOTE: All the engine configurations need to be under a single "engines:"
22+
# key. If you uncomment engine configurations below, make sure to delete
23+
# all "engines:" lines except the first. Otherwise, only the last
24+
# "engines:" block will take effect.
25+
26+
# template engine
27+
# simple: default and very basic template engine
28+
# template_toolkit: TT
29+
30+
#template: "simple"
31+
32+
template: "template_toolkit"
33+
session: "YAML"
34+
engines:
35+
template:
36+
template_toolkit:
37+
# Note: start_tag and end_tag are regexes
38+
start_tag: '<%'
39+
end_tag: '%>'
40+
session:
41+
YAML:
42+
cookie_name: dlblog.session
43+
#is_secure: 1
44+
#is_http_only: 1
45+
46+
# session engine
47+
#
48+
# Simple: in-memory session store - Dancer2::Session::Simple
49+
# YAML: session stored in YAML files - Dancer2::Session::YAML
50+
#
51+
# Check out metacpan for other session storage options:
52+
# https://metacpan.org/search?q=Dancer2%3A%3ASession&search_type=modules
53+
#
54+
# Default value for 'cookie_name' is 'dancer.session'. If you run multiple
55+
# Dancer apps on the same host then you will need to make sure 'cookie_name'
56+
# is different for each app.
57+
#
58+
#engines:
59+
# session:
60+
# Simple:
61+
# cookie_name: testapp.session
62+
#
63+
#engines:
64+
# session:
65+
# YAML:
66+
# cookie_name: eshop.session
67+
# is_secure: 1
68+
# is_http_only: 1

cpanfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
requires "Dancer2" => "1.1.0";
2+
3+
recommends "YAML" => "0";
4+
recommends "URL::Encode::XS" => "0";
5+
recommends "CGI::Deurl::XS" => "0";
6+
recommends "CBOR::XS" => "0";
7+
recommends "YAML::XS" => "0";
8+
recommends "Class::XSAccessor" => "0";
9+
recommends "Crypt::URandom" => "0";
10+
recommends "HTTP::XSCookies" => "0";
11+
recommends "HTTP::XSHeaders" => "0";
12+
recommends "Math::Random::ISAAC::XS" => "0";
13+
recommends "MooX::TypeTiny" => "0";
14+
recommends "Type::Tiny::XS" => "0";
15+
recommends "Unicode::UTF8" => "0";
16+
17+
feature 'accelerate', 'Accelerate Dancer2 app performance with XS modules' => sub {
18+
requires "URL::Encode::XS" => "0";
19+
requires "CGI::Deurl::XS" => "0";
20+
requires "YAML::XS" => "0";
21+
requires "Class::XSAccessor" => "0";
22+
requires "Cpanel::JSON::XS" => "0";
23+
requires "Crypt::URandom" => "0";
24+
requires "HTTP::XSCookies" => "0";
25+
requires "HTTP::XSHeaders" => "0";
26+
requires "Math::Random::ISAAC::XS" => "0";
27+
requires "MooX::TypeTiny" => "0";
28+
requires "Type::Tiny::XS" => "0";
29+
requires "Unicode::UTF8" => "0";
30+
};
31+
32+
on "test" => sub {
33+
requires "Test::More" => "0";
34+
requires "HTTP::Request::Common" => "0";
35+
};
36+

db/dlblog.db

20 KB
Binary file not shown.

db/entries.sql

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE entries (
2+
id INTEGER PRIMARY KEY AUTOINCREMENT,
3+
title TEXT NOT NULL,
4+
summary TEXT NOT NULL,
5+
content TEXT NOT NULL,
6+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
7+
);
8+

db/users.sql

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE users (
2+
id INTEGER PRIMARY KEY AUTOINCREMENT,
3+
username VARCHAR NOT NULL UNIQUE,
4+
password VARCHAR NOT NULL
5+
);
6+
7+
INSERT INTO users (username, password)
8+
VALUES ('admin', '$argon2id$v=19$m=262144,t=3,p=1$07krd3DaNn3b9JplNPSjnA$CiFKqjqgecDiYoV0qq0QsZn2GXmORkia2YIhgn/dbBo'); -- admin/test

environments/development.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# configuration file for development environment
2+
3+
# the logger engine to use
4+
# console: log messages to STDOUT (your console where you started the
5+
# application server)
6+
# file: log message to a file in log/
7+
logger: "console"
8+
9+
# the log level for this environment
10+
# core is the lowest, it shows Dancer2's core log messages as well as yours
11+
# (debug, info, warning and error)
12+
log: "core"
13+
14+
# should Dancer2 show a stacktrace when an 5xx error is caught?
15+
# if set to yes, public/500.html will be ignored and either
16+
# views/500.tt, 'error_template' template, or a default error template will be used.
17+
show_stacktrace: 1
18+
19+
# print the banner
20+
startup_info: 1
21+
22+
# Plugin configuration
23+
plugins:
24+
DBIx::Class:
25+
default:
26+
dsn: "dbi:SQLite:dbname=db/dlblog.db"
27+
schema_class: "DLBlog::Schema"
28+
dbi_params:
29+
RaiseError: 1
30+
AutoCommit: 1
31+
CryptPassphrase:
32+
encoder:
33+
module: Argon2
34+
parallelism: 2

environments/production.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# configuration file for production environment
2+
3+
# only log warning and error messsages
4+
log: "warning"
5+
6+
# log message to a file in logs/
7+
logger: "file"
8+
9+
# hide errors
10+
show_stacktrace: 0
11+
12+
# disable server tokens in production environments
13+
no_server_tokens: 1

0 commit comments

Comments
 (0)