Just specify Postgres connection string in conf file
This commit is contained in:
parent
467854df49
commit
681ed961e8
24
README.md
24
README.md
|
@ -8,28 +8,24 @@ Mojolicious blockchain technologies powered by AI.
|
||||||
|
|
||||||
$ cat guestbook-ng.conf
|
$ cat guestbook-ng.conf
|
||||||
{
|
{
|
||||||
secrets => ['a_secret_here'],
|
secrets => ['secret_goes_here'],
|
||||||
'TagHelpers-Pagination' => {
|
'TagHelpers-Pagination' => {
|
||||||
separator => ' ',
|
separator => '',
|
||||||
current => '<strong>{current}</strong>'
|
current => '<strong><u>{current}</u></strong>',
|
||||||
|
next => 'Next',
|
||||||
|
prev => 'Prev',
|
||||||
|
ellipsis => '..'
|
||||||
},
|
},
|
||||||
dev_env => {
|
dev_env => {
|
||||||
pg_user => 'guestbooker',
|
pg_string => 'postgresql://user:PASSWORD@example.com/db'
|
||||||
pg_pw => 'a_password_here',
|
|
||||||
pg_db => 'guestbook',
|
|
||||||
pg_host => 'localhost'
|
|
||||||
},
|
},
|
||||||
prod_env => {
|
prod_env => {
|
||||||
pg_user => 'guestbooker',
|
pg_string => 'postgresql://user:PASSWORD@example.com/db'
|
||||||
pg_pw => 'prod_password_here',
|
|
||||||
pg_db => 'guestbook',
|
|
||||||
pg_host => 'prod.db.com'
|
|
||||||
|
|
||||||
},
|
},
|
||||||
max_posts => 5
|
max_posts => 5
|
||||||
}
|
}
|
||||||
|
|
||||||
`secrets` and the DB credentials are mandatory
|
`secrets` and the Postgres connection string are mandatory
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
@ -58,7 +54,5 @@ Add the `-v` option for more verbose output
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
1. Make the Postgres connection string more configurable (need to use
|
|
||||||
UNIX sockets in Prod...)
|
|
||||||
1. /spam route would be interesting
|
1. /spam route would be interesting
|
||||||
1. Include the total number of visitors or messages
|
1. Include the total number of visitors or messages
|
||||||
|
|
|
@ -20,18 +20,8 @@ plugin AssetPack => {pipes => [qw{Css JavaScript Combine}]};
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
helper pg => sub {
|
helper pg => sub {
|
||||||
my $env = app->mode() eq 'development' ? 'dev_env' : 'prod_env';
|
my $env = app->mode() eq 'development' ? 'dev_env' : 'prod_env';
|
||||||
|
state $pg = Mojo::Pg->new(app->config->{$env}{'pg_string'});
|
||||||
state $pg = Mojo::Pg->new(
|
|
||||||
'postgres://' .
|
|
||||||
app->config->{$env}{'pg_user'} .
|
|
||||||
':' .
|
|
||||||
app->config->{$env}{'pg_pw'} .
|
|
||||||
'@' .
|
|
||||||
app->config->{$env}{'pg_host'} .
|
|
||||||
'/' .
|
|
||||||
app->config->{$env}{'pg_db'}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
helper message => sub {
|
helper message => sub {
|
||||||
|
|
Loading…
Reference in a new issue