diff --git a/.env.example b/.env.example index 15c7cac59..b59d0b775 100644 --- a/.env.example +++ b/.env.example @@ -139,10 +139,15 @@ SMARTY_CACHE_DRIVER=file FIREWALL_ENABLED=false IGDB_KEY= -TMDB_APIKEY= +TMDB_APIKEY=9a4e16adddcd1e86da19bcaf5ff3c2a3 TMDB_CACHE=false TMDB_LOG=false TVDB_APIKEY= +GIANTBOMB_APIKEY= +ANIDB_APIKEY= +FANARTTV_APIKEY= +OMDB_APIKEY= +TRAKTTV_APIKEY= TEMP_UNRAR_PATH= TEMP_UNZIP_PATH= diff --git a/Blacklight/Games.php b/Blacklight/Games.php index c492f8346..3deb064f6 100755 --- a/Blacklight/Games.php +++ b/Blacklight/Games.php @@ -126,7 +126,7 @@ class Games $this->colorCli = new ColorCLI(); - $this->publicKey = Settings::settingValue('APIs..giantbombkey'); + $this->publicKey = config('nntmux_api.giantbomb_api_key'); $this->gameQty = Settings::settingValue('..maxgamesprocessed') !== '' ? (int) Settings::settingValue('..maxgamesprocessed') : 150; $this->imgSavePath = NN_COVERS.'games'.DS; $this->renamed = (int) Settings::settingValue('..lookupgames') === 2 ? 'AND isrenamed = 1' : ''; diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php index 56dc08148..937293eb6 100755 --- a/Blacklight/Movie.php +++ b/Blacklight/Movie.php @@ -167,16 +167,16 @@ class Movie $this->releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage()); $this->colorCli = new ColorCLI(); - $this->traktcheck = Settings::settingValue('APIs..trakttvclientkey'); + $this->traktcheck = config('nntmux_api.trakttv_api_key'); if ($this->traktcheck !== null) { $this->traktTv = new TraktTv(['Settings' => null]); } $this->client = new Client(); - $this->fanartapikey = Settings::settingValue('APIs..fanarttvkey'); + $this->fanartapikey = config('nntmux_api.fanarttv_api_key'); if ($this->fanartapikey !== null) { $this->fanart = new FanartTV($this->fanartapikey); } - $this->omdbapikey = Settings::settingValue('APIs..omdbkey'); + $this->omdbapikey = config('nntmux_api.omdb_api_key'); if ($this->omdbapikey !== null) { $this->omdbApi = new OMDbAPI($this->omdbapikey); } diff --git a/Blacklight/db/populate/AniDB.php b/Blacklight/db/populate/AniDB.php index 7863bd693..8e32b662f 100755 --- a/Blacklight/db/populate/AniDB.php +++ b/Blacklight/db/populate/AniDB.php @@ -75,7 +75,7 @@ class AniDB $lastupdated = Settings::settingValue('APIs.AniDB.last_full_update'); $this->imgSavePath = NN_COVERS.'anime'.DS; - $this->apiKey = Settings::settingValue('APIs..anidbkey'); + $this->apiKey = config('nntmux_api.anidb_api_key'); $this->updateInterval = $anidbupdint ?? '7'; $this->lastUpdate = $lastupdated ?? '0'; diff --git a/Blacklight/processing/tv/TraktTv.php b/Blacklight/processing/tv/TraktTv.php index 4e6db1e03..0fc6bb50e 100755 --- a/Blacklight/processing/tv/TraktTv.php +++ b/Blacklight/processing/tv/TraktTv.php @@ -54,7 +54,7 @@ class TraktTv extends TV public function __construct(array $options = []) { parent::__construct($options); - $clientId = Settings::settingValue('APIs..trakttvclientkey'); + $clientId = config('nntmux_api.trakttv_api_key'); $requestHeaders = [ 'Content-Type' => 'application/json', 'trakt-api-version' => 2, diff --git a/Changelog b/Changelog index dcac46373..aaad89130 100755 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2020-03-01 DariusIII + * Chg: Move all third party api keys from database to .env file 2020-02-27 DariusIII * Chg: Add option to disable or enable elasticsearch logging 2020-01-27 DariusIII diff --git a/config/nntmux_api.php b/config/nntmux_api.php new file mode 100644 index 000000000..b0323db03 --- /dev/null +++ b/config/nntmux_api.php @@ -0,0 +1,9 @@ + env('ANIDB_APIKEY', ''), + 'giantbomb_api_key' => env('GIANTBOMB_APIKEY', ''), + 'fanarttv_api_key' => env('FANARTTV_APIKEY', ''), + 'omdb_api_key' => env('OMDB_APIKEY', ''), + 'trakttv_api_key' => env('TRAKTTV_APIKEY', ''), +]; diff --git a/database/fixtures/settings.php b/database/fixtures/settings.php index 6c277bbcd..900b9c901 100644 --- a/database/fixtures/settings.php +++ b/database/fixtures/settings.php @@ -801,62 +801,6 @@ return [ 'hint' => 'The minimum total size in bytes to make a release. If set to 0, then ignored. Only deletes during release creation.', 'setting' => 'minsizetoformrelease', ], - 105 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'anidbkey', - 'value' => '', - 'hint' => 'The Anidb api key. Used for Anime lookups.', - 'setting' => 'anidbkey', - ], - 106 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'fanarttvkey', - 'value' => '', - 'hint' => 'The Fanart.tv api key. Used for Fanart.tv lookups. Fanart.tv would appreciate it if you use this service to help them out by adding high quality images not already available on TMDB.', - 'setting' => 'fanarttvkey', - ], - 107 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'giantbombkey', - 'value' => '', - 'hint' => 'The giantbomb api key. Used for game lookups.', - 'setting' => 'giantbombkey', - ], - 108 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'omdbkey', - 'value' => '', - 'hint' => 'OmdbAPIkey obtained from Omdb.Used for Omdb API lookups', - 'setting' => 'omdbkey', - ], - 109 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'rottentomatokey', - 'value' => 'qxbxyngtujprvw7jxam2m6na', - 'hint' => 'The api key used for access to rotten tomatoes.', - 'setting' => 'rottentomatokey', - ], - 110 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'tmdbkey', - 'value' => '9a4e16adddcd1e86da19bcaf5ff3c2a3', - 'hint' => 'The API key used for access to TMDb.', - 'setting' => 'tmdbkey', - ], - 111 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'trakttvclientkey', - 'value' => '', - 'hint' => 'The Trakt.tv API v2 Client ID (SHA256 hash - 64 characters long string). Used for movie and tv lookups.', - 'setting' => 'trakttvclientkey', - ], 112 => [ 'section' => 'APIs', 'subsection' => 'AniDB', diff --git a/database/seeds/SettingsTableSeeder.php b/database/seeds/SettingsTableSeeder.php index 802ed699a..b69e5237b 100644 --- a/database/seeds/SettingsTableSeeder.php +++ b/database/seeds/SettingsTableSeeder.php @@ -798,54 +798,6 @@ class SettingsTableSeeder extends Seeder 'hint' => 'The minimum total size in bytes to make a release. If set to 0, then ignored. Only deletes during release creation.', 'setting' => 'minsizetoformrelease', ], - 105 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'anidbkey', - 'value' => '', - 'hint' => 'The Anidb api key. Used for Anime lookups.', - 'setting' => 'anidbkey', - ], - 106 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'fanarttvkey', - 'value' => '', - 'hint' => 'The Fanart.tv api key. Used for Fanart.tv lookups. Fanart.tv would appreciate it if you use this service to help them out by adding high quality images not already available on TMDB.', - 'setting' => 'fanarttvkey', - ], - 107 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'giantbombkey', - 'value' => '', - 'hint' => 'The giantbomb api key. Used for game lookups.', - 'setting' => 'giantbombkey', - ], - 108 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'omdbkey', - 'value' => '', - 'hint' => 'OmdbAPIkey obtained from Omdb.Used for Omdb API lookups', - 'setting' => 'omdbkey', - ], - 109 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'rottentomatokey', - 'value' => 'qxbxyngtujprvw7jxam2m6na', - 'hint' => 'The api key used for access to rotten tomatoes.', - 'setting' => 'rottentomatokey', - ], - 111 => [ - 'section' => 'APIs', - 'subsection' => '', - 'name' => 'trakttvclientkey', - 'value' => '', - 'hint' => 'The Trakt.tv API v2 Client ID (SHA256 hash - 64 characters long string). Used for movie and tv lookups.', - 'setting' => 'trakttvclientkey', - ], 112 => [ 'section' => 'APIs', 'subsection' => 'AniDB', diff --git a/misc/testing/Tests/test_fanarttv_API.php b/misc/testing/Tests/test_fanarttv_API.php index 765a5014e..05d4033d0 100644 --- a/misc/testing/Tests/test_fanarttv_API.php +++ b/misc/testing/Tests/test_fanarttv_API.php @@ -6,7 +6,7 @@ use App\Models\Settings; use Blacklight\ColorCLI; use Blacklight\libraries\FanartTV; -$fanart = new FanartTV(Settings::settingValue('APIs..fanarttvkey')); +$fanart = new FanartTV(config('nntmux_api.fanarttv_api_key')); $colorCli = new ColorCLI(); if (! empty($argv[1])) { diff --git a/resources/views/themes/admin/site-edit.tpl b/resources/views/themes/admin/site-edit.tpl index 898c0c042..ded9c5219 100644 --- a/resources/views/themes/admin/site-edit.tpl +++ b/resources/views/themes/admin/site-edit.tpl @@ -116,7 +116,7 @@
- 3rd Party API Keys + 3rd Party API Keys (will be removed, all values should be in .env)