zvi: Gaius Balthar: Oh, Frak. (fuck me)
still kind of a stealthy love ninja ([personal profile] zvi) wrote in [site community profile] dw_dev_training2009-09-25 02:58 pm
Entry tags:

What's wrong with my Schwartz?

When I set up $LJHOME/etc/config-private.pl, I didn't set it up correctly in some ways I now know were wrong, but I didn't realize that before I protected my config files from updates.

My $LJHOME/cvs/local/etc/config-private.pl file now looks like
#!/usr/bin/perl

# Dreamwidth configuration file.  Copy this out of the documentation   
# directory to etc/config-private.pl and edit as necessary.  The reason
# it's not in the etc directory already is to protect it from
# getting clobbered when you upgrade to the newest Dreamwidth code in
# the future.
#
# This is where you define private, site-specific configs (e.g. passwords).
 
{
    package LJ;

    # database info.  only the master is necessary.
    %DBINFO = (
               'master' => {  # master must be named 'master'
                   'host' => "localhost",
                   'port' => 3306,
                   'user' => 'dh_zvi',         
                   'pass' => 'FAKE PASSWORD',       
                   'dbname' => 'dreamhack_zvi',
                   'role' => {
                       'cluster1' => 1,
                       'slow' => 1,

                       # optionally, apache write its access logs to a mysql database
                       #logs => 1,
                   },
               },
               # example of a TCP-based DB connection
               #'somehostname' => {
               #    'host' => "somehost",
               #    'port' => 1234,
               #    'user' => 'username',
               #    'pass' => 'password',
               #},
               # example of a UNIX domain-socket DB connection
               #'otherhost' => {
               #    'sock' => "$HOME/var/mysqld.sock",
               #    'user' => 'username',
               #    'pass' => 'password',
               #},
    );

    # Schwartz DB configuration
    @THESCHWARTZ_DBS = (
            {
                dsn => 'dbi:mysql:dreamhack_zvi;host=localhost',
                user => 'dh_zvi',
                pass => '$DW::PRIVATE::THESCHWARTZ_DBS{pass}',
            },
        );

    # allow changelog posting.  this allows unauthenticated posts to the changelog
    # community from the IP and users specified.  this does not work on its own,
    # you have to configure your version control server to do the posting.  see
    # cgi-bin/DW/Hooks/Changelog.pm for more information.
    %CHANGELOG = (
        enabled          => 0,
        community        => 'changelog',
        allowed_posters  => [ qw/ mark denise / ],
        allowed_ips      => [ qw/ 123.123.123.123 / ],
    );

    # example user account for FAQs. By default, [[username]] in an FAQ answer
    # will use the username of the logged-in user; however, if the viewer is  
    # not logged in, this username will be used instead. (You should own this 
    # account so that nobody can take it.)
    $EXAMPLE_USER_ACCOUNT = "username";   

    # list of official journals, as a list of "'username' => 1" pairs
    # used to determine whether to fire off an OfficialPost notification
    # when an entry is posted; hash instead of array for efficiency
    %OFFICIAL_JOURNALS = (
        news => 1,
    );
      
    # the "news" journal, to be specially displayed on the front page, etc
    $NEWS_JOURNAL = "news";

    # list of alternate domains that point to your site.
    @ALTERNATE_DOMAINS = (
        'ljsite.org',
        'ljsite.net',
        'ljsite.co.uk',
        'ljsite.tld',  
    );

    # configuration/ID for statistics tracker modules which apply to
    # site pages (www, non-journal)
    %SITE_PAGESTAT_CONFIG = (
    #    google_analytics => 'UA-xxxxxx-x',
    );

    # Path (e.g. /bots) at which a informational page about your acceptable bot
    # policies are documented.  This URI is excluded from anti-bot measures, so
    # make sure it's as permissive as possible to allow humans in who may be   
    # lazy in their typing.  For example, leave off the trailing slash (/bots  
    # instead of /bots/) if your URI is a directory.
    #$BLOCKED_BOT_URI = '/bots';

    # If you wish to publish PubSubHubbub notifications, uncomment this.  You can
    # use this default hub location, as it's supported by Google, or you can run 
    # your own (or use any other hub you want).
    # @HUBBUB_HUBS = ( 'http://pubsubhubbub.appspot.com/' );

}
 
{
    package DW::PRIVATE;

    $DOMAIN = "zvi.hack.dreamwidth.net";

    #%PAYPAL = (
    #    user => ,
    #    password => ,
    #    signature => ,
    #    email => ,
    #);

    #%DBINFO = (
    #    master => {
    #        pass => ,
    #    },

    %THESCHWARTZ_DBS = (
        pass => 'FAKE PASSWORD',
    ); 

    #%RECAPTCHA = (
    #    public_key  => ,  
    #    private_key => ,
    #);
}

1;


My $LJHOME/etc/config-private.pl looks similar to that, but with these differences. (When I tried to edit that file directly to make the changes, it through a 500 error at my dreamhack. Reverting made it work okay, again.)

    # database info.  only the master is necessary.
    %DBINFO = (
               'master' => {  # master must be named 'master'
                   'host' => "localhost",
                   'port' => 3306,
                   'user' => 'dh_zvi',
                   'pass' => 'DEFAULT PASSWORD',    # CHANGETHIS
                   'dbname' => 'dreamhack_zvi',
                   'role' => {
                       'cluster1' => 1,
                       'slow' => 1,
…
    #%THESCHWARTZ_DBS = (
    #    pass => 'FAKE PASSWORD',
    #);


What changes do I need to make to what file to get the Schwartz to work?
alierak: (Default)

[personal profile] alierak 2009-09-26 01:59 pm (UTC)(link)
Sorry, I didn't see you asking that question. Variables are interpolated in double-quoted strings but not single-quoted, that's all. If your entire string is the value of some variable, you don't need the quotes at all, as [personal profile] exor674 pointed out.

But anyway. Please don't take 500 errors (or technical advice) personally, if at all possible. It will happen to everyone, even those who know perl. You'll hit an error, you'll need a second opinion. That's normal. I think the best thing you can do is know where to look to start troubleshooting. I assume you need that advice only because you came to this discussion without the error message in hand. It also matters what this thread will look like to others who want to learn -- I just didn't want to leave your question unanswered, even though it didn't entirely make sense to me. Sorry if that was too vague.

That said, I stand by my first reactions here: (a) the variable is going to be undef at that point in the code, (b) it doesn't matter which file you edit as long as both of them have your changes when you're done, and (c) please look in error_log for more diagnostic info when you get an error. My intuition tells me that using an undefined variable could have been the error, but I can't say exactly what happened without seeing the error message.