|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Pterodactyl - Panel |
| 4 | + * Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com> |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be included in all |
| 14 | + * copies or substantial portions of the Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | + * SOFTWARE. |
| 23 | + */ |
| 24 | +use Illuminate\Database\Seeder; |
| 25 | + |
| 26 | +use Pterodactyl\Models; |
| 27 | + |
| 28 | +class VoiceServiceTableSeeder extends Seeder |
| 29 | +{ |
| 30 | + /** |
| 31 | + * The core service ID. |
| 32 | + * |
| 33 | + * @var Models\Service |
| 34 | + */ |
| 35 | + protected $service; |
| 36 | + |
| 37 | + /** |
| 38 | + * Stores all of the option objects |
| 39 | + * |
| 40 | + * @var array |
| 41 | + */ |
| 42 | + protected $option = []; |
| 43 | + |
| 44 | + /** |
| 45 | + * Run the database seeds. |
| 46 | + * |
| 47 | + * @return void |
| 48 | + */ |
| 49 | + public function run() |
| 50 | + { |
| 51 | + $this->addCoreService(); |
| 52 | + $this->addCoreOptions(); |
| 53 | + $this->addVariables(); |
| 54 | + } |
| 55 | + |
| 56 | + private function addCoreService() |
| 57 | + { |
| 58 | + $this->service = Models\Service::create([ |
| 59 | + 'author' => 'ptrdctyl-v040-11e6-8b77-86f30ca893d3', |
| 60 | + 'name' => 'Voice Servers', |
| 61 | + 'description' => 'Voice servers such as Mumble and Teamspeak 3.', |
| 62 | + 'file' => 'voice', |
| 63 | + 'executable' => '', |
| 64 | + 'startup' => '' |
| 65 | + ]); |
| 66 | + } |
| 67 | + |
| 68 | + private function addCoreOptions() |
| 69 | + { |
| 70 | + $this->option['mumble'] = Models\ServiceOptions::create([ |
| 71 | + 'parent_service' => $this->service->id, |
| 72 | + 'name' => 'Mumble Server', |
| 73 | + 'description' => 'Mumble is an open source, low-latency, high quality voice chat software primarily intended for use while gaming.', |
| 74 | + 'tag' => 'mumble', |
| 75 | + 'docker_image' => 'quay.io/pterodactyl/voice:mumble', |
| 76 | + 'executable' => './murmur.x86', |
| 77 | + 'startup' => '-fg' |
| 78 | + ]); |
| 79 | + } |
| 80 | + |
| 81 | + private function addVariables() |
| 82 | + { |
| 83 | + Models\ServiceVariables::create([ |
| 84 | + 'option_id' => $this->option['mumble']->id, |
| 85 | + 'name' => 'Maximum Users', |
| 86 | + 'description' => 'Maximum concurrent users on the mumble server.', |
| 87 | + 'env_variable' => 'MAX_USERS', |
| 88 | + 'default_value' => '100', |
| 89 | + 'user_viewable' => 1, |
| 90 | + 'user_editable' => 0, |
| 91 | + 'required' => 1, |
| 92 | + 'regex' => '/^(\d){1,6}$/' |
| 93 | + ]); |
| 94 | + |
| 95 | + Models\ServiceVariables::create([ |
| 96 | + 'option_id' => $this->option['vanilla']->id, |
| 97 | + 'name' => 'Server Version', |
| 98 | + 'description' => 'Version of Mumble Server to download and use.', |
| 99 | + 'env_variable' => 'MUMBLE_VERSION', |
| 100 | + 'default_value' => '1.2.16', |
| 101 | + 'user_viewable' => 1, |
| 102 | + 'user_editable' => 1, |
| 103 | + 'required' => 1, |
| 104 | + 'regex' => '/^([0-9_\.-]{5,8})$/' |
| 105 | + ]); |
| 106 | + } |
| 107 | +} |
0 commit comments