From 7dc9004e7ddcf7457dc95e056de95cd7df363430 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Fri, 2 Jun 2017 12:44:38 +0200 Subject: [PATCH] New Config for sukebei Just launch with : `./nyaa -conf config/sukebei.yml` --- config/config.go | 10 ++-------- config/sukebei.yml | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 config/sukebei.yml diff --git a/config/config.go b/config/config.go index 625d1bbe..f8a7d76a 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,6 @@ import ( "io" "io/ioutil" "log" - "os" yaml "gopkg.in/yaml.v2" ) @@ -95,16 +94,11 @@ func (config *Config) BindFlags() func() error { // HandleConfFileFlag : Read the config from a file func (config *Config) HandleConfFileFlag(path string) error { if path != "" { - file, err := os.Open(path) + data, err := ioutil.ReadFile(path) if err != nil { return fmt.Errorf("can't read file '%s'", path) } - var b []byte - _, err = file.Read(b) - if err != nil { - return fmt.Errorf("failed to parse file '%s' (%s)", path, err) - } - err = yaml.Unmarshal(b, config) + err = yaml.Unmarshal(data, config) if err != nil { return fmt.Errorf("failed to parse file '%s' (%s)", path, err) } diff --git a/config/sukebei.yml b/config/sukebei.yml new file mode 100644 index 00000000..239b74f4 --- /dev/null +++ b/config/sukebei.yml @@ -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