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
|
||||
{
|
||||
secrets => ['a_secret_here'],
|
||||
secrets => ['secret_goes_here'],
|
||||
'TagHelpers-Pagination' => {
|
||||
separator => ' ',
|
||||
current => '<strong>{current}</strong>'
|
||||
separator => '',
|
||||
current => '<strong><u>{current}</u></strong>',
|
||||
next => 'Next',
|
||||
prev => 'Prev',
|
||||
ellipsis => '..'
|
||||
},
|
||||
dev_env => {
|
||||
pg_user => 'guestbooker',
|
||||
pg_pw => 'a_password_here',
|
||||
pg_db => 'guestbook',
|
||||
pg_host => 'localhost'
|
||||
pg_string => 'postgresql://user:PASSWORD@example.com/db'
|
||||
},
|
||||
prod_env => {
|
||||
pg_user => 'guestbooker',
|
||||
pg_pw => 'prod_password_here',
|
||||
pg_db => 'guestbook',
|
||||
pg_host => 'prod.db.com'
|
||||
|
||||
pg_string => 'postgresql://user:PASSWORD@example.com/db'
|
||||
},
|
||||
max_posts => 5
|
||||
}
|
||||
|
||||
`secrets` and the DB credentials are mandatory
|
||||
`secrets` and the Postgres connection string are mandatory
|
||||
|
||||
## Testing
|
||||
|
||||
|
@ -58,7 +54,5 @@ Add the `-v` option for more verbose output
|
|||
|
||||
## TODOs
|
||||
|
||||
1. Make the Postgres connection string more configurable (need to use
|
||||
UNIX sockets in Prod...)
|
||||
1. /spam route would be interesting
|
||||
1. Include the total number of visitors or messages
|
||||
|
|
|
@ -21,17 +21,7 @@ plugin AssetPack => {pipes => [qw{Css JavaScript Combine}]};
|
|||
# Helpers
|
||||
helper pg => sub {
|
||||
my $env = app->mode() eq 'development' ? 'dev_env' : 'prod_env';
|
||||
|
||||
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'}
|
||||
);
|
||||
state $pg = Mojo::Pg->new(app->config->{$env}{'pg_string'});
|
||||
};
|
||||
|
||||
helper message => sub {
|
||||
|
|
Loading…
Reference in a new issue