Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

New Config for sukebei

Just launch with : `./nyaa -conf config/sukebei.yml`
Cette révision appartient à :
akuma06 2017-06-02 12:44:38 +02:00
Parent b6989f77d0
révision 7dc9004e7d
2 fichiers modifiés avec 22 ajouts et 8 suppressions

Voir le fichier

@ -7,7 +7,6 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
"os"
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v2"
) )
@ -95,16 +94,11 @@ func (config *Config) BindFlags() func() error {
// HandleConfFileFlag : Read the config from a file // HandleConfFileFlag : Read the config from a file
func (config *Config) HandleConfFileFlag(path string) error { func (config *Config) HandleConfFileFlag(path string) error {
if path != "" { if path != "" {
file, err := os.Open(path) data, err := ioutil.ReadFile(path)
if err != nil { if err != nil {
return fmt.Errorf("can't read file '%s'", path) return fmt.Errorf("can't read file '%s'", path)
} }
var b []byte err = yaml.Unmarshal(data, config)
_, err = file.Read(b)
if err != nil {
return fmt.Errorf("failed to parse file '%s' (%s)", path, err)
}
err = yaml.Unmarshal(b, config)
if err != nil { if err != nil {
return fmt.Errorf("failed to parse file '%s' (%s)", path, err) return fmt.Errorf("failed to parse file '%s' (%s)", path, err)
} }

20
config/sukebei.yml Fichier normal
Voir le fichier

@ -0,0 +1,20 @@
# Configuration file for NyaaPantsu
# Please, do not change default_config, create your own config.yml
# You do not have to change every values, just set here what you want to edit
# For example, if you just want to change the port, just write:
#port: 9998
models:
# LastOldTorrentID is the highest torrent ID that was copied from the original Nyaa
last_old_torrent_id: 2303945
# TorrentsTableName : Name of torrent table in DB
torrents_table_name: sukebei_torrents
# ReportsTableName : Name of torrent report table in DB
reports_table_name: sukebei_torrent_reports
# CommentsTableName : Name of comments table in DB
comments_table_name: sukebei_comments
# UploadsOldTableName : Name of uploads table in DB
uploads_old_table_name: sukebei_user_uploads_old
# FilesTableName : Name of files table in DB
files_table_name: sukebei_files
# NotificationTableName : Name of notifications table in DB
notifications_table_name: sukebei_notifications