summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-09-12 17:07:46 +0200
committerYorhel <git@yorhel.nl>2019-09-12 17:54:50 +0200
commitadc906096f4644788b970e5ed936ca3e70bde2e8 (patch)
tree8d2aacf12b008820a5a331e648f915a67987cdfb /data
parent752bc1724968a1f15b17ba9e607f2163997b4efa (diff)
Add VNDB::Config module and unified conf.pl config file
This gets rid of global.pl, config.pl and config3.pl and uses the cleaner config3.pl format for the config file. The config is easily accessible from anywhere by importing the new VNDB::Config module; The global $VNDB::S,O,M,ROOT variables have been removed. Sorry for all the churn...
Diffstat (limited to 'data')
-rw-r--r--data/conf_example.pl41
-rw-r--r--data/config3_example.pl26
-rw-r--r--data/config_example.pl41
-rw-r--r--data/global.pl107
4 files changed, 41 insertions, 174 deletions
diff --git a/data/conf_example.pl b/data/conf_example.pl
new file mode 100644
index 00000000..5885e8e9
--- /dev/null
+++ b/data/conf_example.pl
@@ -0,0 +1,41 @@
+{
+ # Canonical URL of this site
+ url => 'http://localhost:3000',
+ # And of the static files (leave unset to use `url`)
+ #url_static => 'http://localhost:3000',
+
+ # Salt used to generate the CSRF tokens
+ form_salt => '<some unique string>',
+ # Global salt used to hash user passwords (used in addition to a user-specific salt)
+ scrypt_salt => '<another unique string>',
+
+ # TUWF configuration options, see the TUWF::set() documentation for options.
+ tuwf => {
+ db_login => [ 'dbi:Pg:dbname=vndb', 'vndb_site', 'vndb_site' ],
+ xml_pretty => 0,
+ log_queries => 0,
+ debug => 1,
+ cookie_defaults => { domain => 'localhost', path => '/' },
+ mail_sendmail => 'log',
+ },
+
+ # Uncomment if you want to test password strength against a dictionary. See
+ # lib/PWLookup.pm for instructions on how to create the database file.
+ #password_db => 'data/passwords.dat',
+
+ # Options for Multi, the background server.
+ Multi => {
+ # Each module in lib/Multi/ can be enabled and configured here.
+ Core => {
+ db_login => { dbname => 'vndb', user => 'vndb_multi', password => 'vndb_multi' },
+ },
+ #API => {},
+ #IRC => {
+ # nick => 'MyVNDBBot',
+ # server => 'irc.synirc.net',
+ # channels => [ '#vndb' ],
+ # pass => '<nickserv-password>',
+ # masters => [ 'yorhel!~Ayo@your.hell' ],
+ #},
+ },
+}
diff --git a/data/config3_example.pl b/data/config3_example.pl
deleted file mode 100644
index d640df5f..00000000
--- a/data/config3_example.pl
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- # Canonical URL of this site
- url => 'http://localhost:3000',
- # And of the static files (may be the same as the above url)
- url_static => 'http://localhost:3000',
-
- # TUWF configuration options, see the TUWF::set() documentation for options.
- tuwf => {
- db_login => [ 'dbi:Pg:dbname=vndb', 'vndb_site', 'vndb_site' ],
- xml_pretty => 0,
- log_queries => 0,
- debug => 1,
- cookie_defaults => { domain => 'localhost', path => '/' },
- mail_sendmail => 'log',
- },
-
- # Configuration of the authentication module (VNDB::Auth)
- auth => {
- csrf_key => '<some unique string>',
- scrypt_salt => '<another unique string>',
- },
-
- # Uncomment if you want to test password strength against a dictionary. See
- # lib/PWLookup.pm for instructions on how to create the database file.
- #password_db => 'data/passwords.dat',
-}
diff --git a/data/config_example.pl b/data/config_example.pl
deleted file mode 100644
index 30731d08..00000000
--- a/data/config_example.pl
+++ /dev/null
@@ -1,41 +0,0 @@
-package VNDB;
-
-# This file is used to override config options in global.pl.
-# You can override anything you want.
-
-%O = (
- %O,
- db_login => [ 'dbi:Pg:dbname=vndb', 'vndb_site', 'vndb_site' ],
- #logfile => $ROOT.'/err.log',
- xml_pretty => 0,
- log_queries => 0,
- debug => 1,
- cookie_defaults => { domain => 'localhost', path => '/' },
- mail_sendmail => 'log',
-);
-
-%S = (
- %S,
- url => 'http://localhost:3000',
- url_static => 'http://localhost:3000',
- form_salt => '<some unique string>',
- scrypt_salt => '<another unique string>',
- # Uncomment if you want to test password strength against a dictionary. See
- # lib/PWLookup.pm for instructions on how to create the database file.
- #password_db => $ROOT.'/data/passwords.dat',
-);
-
-$M{db_login} = { dbname => 'vndb', user => 'vndb_multi', password => 'vndb_multi' };
-
-# Uncomment to enable certain features of Multi
-
-#$M{modules}{API} = {};
-#$M{modules}{APIDump} = {};
-
-#$M{modules}{IRC} = {
-# nick => 'MyVNDBBot',
-# server => 'irc.synirc.net',
-# channels => [ '#vndb' ],
-# pass => '<nickserv-password>',
-# masters => [ 'yorhel!~Ayo@your.hell' ],
-#};
diff --git a/data/global.pl b/data/global.pl
deleted file mode 100644
index 80051235..00000000
--- a/data/global.pl
+++ /dev/null
@@ -1,107 +0,0 @@
-
-package VNDB;
-
-use utf8;
-use strict;
-use warnings;
-use Tie::IxHash;
-
-our $ROOT;
-
-# Convenient wrapper to create an ordered hash
-sub ordhash { my %x; tie %x, 'Tie::IxHash', @_; \%x }
-
-
-# options for TUWF
-our %O = (
- db_login => [ 'dbi:Pg:dbname=vndb', 'vndb_site', 'passwd' ],
- debug => 1,
- logfile => $ROOT.'/data/log/vndb.log',
- cookie_prefix => 'vndb_',
- cookie_defaults => {
- domain => '.vndb.org',
- path => '/',
- },
-);
-
-
-# VNDB-specific options (object_data)
-our %S;
-%S = (%S,
- version => `cd $ROOT; git describe` =~ /^(.+)$/ && $1,
- url => 'http://vndb.org', # Only used by Multi, web pages infer their own address
- url_static => 'http://s.vndb.org',
- skin_default => 'angel',
- placeholder_img => 'http://s.vndb.org/s/angel/bg.jpg', # Used in the og:image meta tag
- form_salt => 'a-private-string-here',
- scrypt_args => [ 65536, 8, 1 ], # N, r, p
- scrypt_salt => 'another-random-string',
- regen_static => 0,
- source_url => 'http://git.blicky.net/vndb.git/?h=master',
- admin_email => 'contact@vndb.org',
- login_throttle => [ 24*3600/10, 24*3600 ], # interval between attempts, max burst (10 a day)
- scr_size => [ 136, 102 ], # w*h of screenshot thumbnails
- ch_size => [ 256, 300 ], # max. w*h of char images
- cv_size => [ 256, 400 ], # max. w*h of cover images
- # bit flags (Flag 8 was used for staffedit and 256 for affiliates, now free to re-use)
- # The 'usermod' flag is hardcoded in sql/func.sql for user_* functions.
- permissions => {qw| board 1 boardmod 2 edit 4 tag 16 dbmod 32 tagmod 64 usermod 128 |},
- default_perm => 1+4+16, # Keep synchronised with the default value of users.perm
- default_tags_cat=> 'cont,tech',
- board_edit_time => 7*24*3600,
- atom_feeds => { # num_entries, title, id
- announcements => [ 10, 'VNDB Site Announcements', '/t/an' ],
- changes => [ 25, 'VNDB Recent Changes', '/hist' ],
- posts => [ 25, 'VNDB Recent Posts', '/t' ],
- },
- poll_options => 20, # max number of options in discussion board polls
- engines => [ grep $_, split /\s*\n\s*/, q{
- BGI/Ethornell
- CatSystem2
- codeX RScript
- EntisGLS
- Ikura GDL
- KiriKiri
- Majiro
- NScripter
- QLIE
- RPG Maker
- RealLive
- Ren'Py
- Shiina Rio
- Unity
- YU-RIS
- }],
- dlsite_url => 'https://www.dlsite.com/%s/work/=/product_id/%%s.html',
- denpa_url => 'https://denpasoft.com/products/%s',
- jlist_url => 'https://www.jlist.com/%s',
- jbox_url => 'https://www.jbox.com/%s',
- mg_r18_url => 'https://www.mangagamer.com/r18/detail.php?product_code=%d',
- mg_main_url => 'https://www.mangagamer.com/detail.php?product_code=%d',
-);
-
-
-# Multi-specific options (Multi also uses some options in %S and %O)
-our %M = (
- log_dir => $ROOT.'/data/log',
- log_level => 'trace',
- modules => {
- #API => {}, # disabled by default, not really needed
- Feed => {},
- RG => {},
- #Anime => {}, # disabled by default, requires AniDB username/pass
- Maintenance => {},
- #IRC => {}, # disabled by default, no need to run an IRC bot when debugging
- #Wikidata => {}, # disabled by default, no need to bother the Wikidata API when debugging
- #JList => {},
- #MG => {},
- #Denpa => { api => '', user => '', pass => '' },
- },
-);
-
-
-# allow the settings to be overwritten in config.pl
-require $ROOT.'/data/config.pl' if -f $ROOT.'/data/config.pl';
-
-1;
-