[Dancer-users] How to un-prettify JSON?

Alex Knowles alexk at moonfruit.com
Tue Mar 15 15:40:20 CET 2011


On Mon, 2011-03-14 at 20:29 +0000, franck wrote:
>         
>         > could you try to set PLACK_ENV to development inside your
>         apache configuration (if you're using plack of course)
>         >
>         
>         
>         Sorry, I am not using plack.
>         
>         
>         
> 
> 
> ok, so there is an issue somewhere else :/
> 

We've had this issue as well - our service definitely isn't in
development mode :)

but i've found this:

in Dancer::Config.pm

    $SETTINGS->{environment}
      ||= $ENV{DANCER_ENVIRONMENT}
      || $ENV{PLACK_ENV}
      || 'development';

which looks like it might be doing it.

Alex

> 
> will try to reproduce the issue.
>  
>         
>         > On Sun, Mar 13, 2011 at 8:26 PM, Mr. Puneet Kishor
>         <punk.kish at gmail.com> wrote:
>         >
>         > On Mar 13, 2011, at 12:40 PM, sawyer x wrote:
>         >
>         > > Hi,
>         > >
>         > > I've checked the code and apparently pretty printing is
>         only on if you're in the "development" dancefloor. :)
>         > >
>         > >
>         >
>         > Ok. I am "supposedly" on the development dancefloor, so
>         perhaps that is why I am getting prettified JSON, although I
>         would like to make it more compact, and now I can.
>         >
>         > But, see my email from Mar 5. I reproduce it below. As the
>         following email details, I have been under the impression that
>         I just can't get the development environment to kick in under
>         Apache. One of the results of this effect is that I don't get
>         anything in my development.log.
>         >
>         > If I use the Dancer built-in server, I am able to see
>         messages in development.log, however, if I were to use the
>         built-in server, the built-in server doesn't allow me to set
>         aliases to directories (another query that I posted on Mar 5
>         was on this issue -- no resolution of that as yet).
>         >
>         > ----
>         > I can't figure out how to tell Dancer that my app should use
>         development.yml under Apache.
>         >
>         > I have the following in vhosts.conf
>         >
>         > SetEnv DANCER_ENVIRONMENT "development"
>         >
>         > When I put the following fragment in config.yml, everything
>         works
>         >
>         > db_name: "mydb"
>         > db_user: "dev"
>         > db_pass: "dev"
>         >
>         > When I take the above fragment out of config.yml, and put it
>         in development.yml, all the config->{} values are empty. For
>         example, I get the following error in my Apache log
>         >
>         > DBI connect('dbname=','',...) failed: FATAL:
>         >
>         > because, my code is
>         >
>         > my $dbh = DBI->connect(
>         >        "dbi:Pg:dbname=" . config->{db_name},
>         >        config->{db_user},
>         >        config->{db_pass},
>         >        {AutoCommit => 0}
>         > );
>         >
>         > If I put the above in development.yml, and put the following
>         in production.yml, it fails because it can't find the prod
>         databases
>         >
>         > db_name: "mydb"
>         > db_user: "prod"
>         > db_pass: "prod"
>         >
>         > It is almost as if development.yml is not being seen at all.
>         It is being bypassed. Maybe that also explains why I am not
>         getting any development.log.
>         >
>         > Any ideas? I am using Dancer 1.3011.
>         >
>         > Puneet,
>         > _______________________________________________
>         > Dancer-users mailing list
>         > Dancer-users at perldancer.org
>         > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>         >
>         >
>         >
>         > --
>         > franck cuny
>         > http://lumberjaph.net - http://github.com/franckcuny
>         >
>         
>         _______________________________________________
>         Dancer-users mailing list
>         Dancer-users at perldancer.org
>         http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>         
> 
> 
> 
> -- 
> franck cuny
> http://lumberjaph.net - http://github.com/franckcuny
> 




More information about the Dancer-users mailing list