From 8e212889a4b706fc538ebebf188a7fc97e16d069 Mon Sep 17 00:00:00 2001 From: Ferks-FK Date: Thu, 2 Feb 2023 15:45:17 +0000 Subject: [PATCH] Create all the settings files. --- app/Settings/DiscordSettings.php | 25 +++++++++++++ app/Settings/InvoiceSettings.php | 29 +++++++++++++++ app/Settings/LocaleSettings.php | 23 ++++++++++++ app/Settings/MailSettings.php | 31 ++++++++++++++++ app/Settings/PterodactylSettings.php | 21 +++++++++++ app/Settings/ReferralSettings.php | 25 +++++++++++++ app/Settings/ServerSettings.php | 19 ++++++++++ app/Settings/UserSettings.php | 37 +++++++++++++++++++ app/Settings/WebsiteSettings.php | 29 +++++++++++++++ ...2023_02_01_181453_create_mail_settings.php | 16 ++++---- ...3_02_01_182043_create_discord_settings.php | 6 +-- ...3_02_01_182158_create_website_settings.php | 1 - 12 files changed, 250 insertions(+), 12 deletions(-) create mode 100644 app/Settings/DiscordSettings.php create mode 100644 app/Settings/InvoiceSettings.php create mode 100644 app/Settings/LocaleSettings.php create mode 100644 app/Settings/MailSettings.php create mode 100644 app/Settings/PterodactylSettings.php create mode 100644 app/Settings/ReferralSettings.php create mode 100644 app/Settings/ServerSettings.php create mode 100644 app/Settings/UserSettings.php create mode 100644 app/Settings/WebsiteSettings.php diff --git a/app/Settings/DiscordSettings.php b/app/Settings/DiscordSettings.php new file mode 100644 index 00000000..3065c05c --- /dev/null +++ b/app/Settings/DiscordSettings.php @@ -0,0 +1,25 @@ +migrator->add('mail.mail_host', ($this->getOldValue('SETTINGS::MAIL:HOST') != null) ?: ''); - $this->migrator->add('mail.mail_port', ($this->getOldValue('SETTINGS::MAIL:PORT') != null) ?: 'mailhog'); - $this->migrator->add('mail.mail_username', ($this->getOldValue('SETTINGS::MAIL:USERNAME') != null) ?: null); - $this->migrator->add('mail.mail_password', ($this->getOldValue('SETTINGS::MAIL:PASSWORD') != null) ?: null); - $this->migrator->add('mail.mail_encryption', ($this->getOldValue('SETTINGS::MAIL:ENCRYPTION') != null) ?: null); - $this->migrator->add('mail.mail_from_address', ($this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') != null) ?: null); - $this->migrator->add('mail.mail_from_name', ($this->getOldValue('SETTINGS::MAIL:FROM_NAME') != null) ?: 'ControlPanel.gg'); - $this->migrator->add('mail.mail_mailer', ($this->getOldValue('SETTINGS::MAIL:MAILER') != null) ?: 'smtp'); + $this->migrator->add('mail.mail_host', ($this->getOldValue('SETTINGS::MAIL:HOST') != null) ?: env('MAIL_HOST', 'localhost')); + $this->migrator->add('mail.mail_port', ($this->getOldValue('SETTINGS::MAIL:PORT') != null) ?: env('MAIL_PORT', '25')); + $this->migrator->add('mail.mail_username', ($this->getOldValue('SETTINGS::MAIL:USERNAME') != null) ?: env('MAIL_USERNAME', '')); + $this->migrator->addEncrypted('mail.mail_password', ($this->getOldValue('SETTINGS::MAIL:PASSWORD') != null) ?: env('MAIL_PASSWORD', '')); + $this->migrator->add('mail.mail_encryption', ($this->getOldValue('SETTINGS::MAIL:ENCRYPTION') != null) ?: env('MAIL_ENCRYPTION', 'tls')); + $this->migrator->add('mail.mail_from_address', ($this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') != null) ?: env('MAIL_FROM_ADDRESS', '')); + $this->migrator->add('mail.mail_from_name', ($this->getOldValue('SETTINGS::MAIL:FROM_NAME') != null) ?: env('APP_NAME', 'ControlPanel.gg')); + $this->migrator->add('mail.mail_mailer', ($this->getOldValue('SETTINGS::MAIL:MAILER') != null) ?: env('MAIL_MAILER', 'smtp')); $this->migrator->add('mail.mail_enabled', true); } diff --git a/database/settings/2023_02_01_182043_create_discord_settings.php b/database/settings/2023_02_01_182043_create_discord_settings.php index 34f06141..bbc03009 100644 --- a/database/settings/2023_02_01_182043_create_discord_settings.php +++ b/database/settings/2023_02_01_182043_create_discord_settings.php @@ -8,9 +8,9 @@ class CreateDiscordSettings extends SettingsMigration public function up(): void { // Get the user-set configuration values from the old table. - $this->migrator->add('discord.bot_token', ($this->getOldValue('SETTINGS::DISCORD:BOT_TOKEN') != null) ?: null); - $this->migrator->add('discord.client_id', ($this->getOldValue('SETTINGS::DISCORD:CLIENT_ID') != null) ?: null); - $this->migrator->add('discord.client_secret', ($this->getOldValue('SETTINGS::DISCORD:CLIENT_SECRET') != null) ?: null); + $this->migrator->addEncrypted('discord.bot_token', ($this->getOldValue('SETTINGS::DISCORD:BOT_TOKEN') != null) ?: null); + $this->migrator->addEncrypted('discord.client_id', ($this->getOldValue('SETTINGS::DISCORD:CLIENT_ID') != null) ?: null); + $this->migrator->addEncrypted('discord.client_secret', ($this->getOldValue('SETTINGS::DISCORD:CLIENT_SECRET') != null) ?: null); $this->migrator->add('discord.guild_id', ($this->getOldValue('SETTINGS::DISCORD:GUILD_ID') != null) ?: null); $this->migrator->add('discord.invite_url', ($this->getOldValue('SETTINGS::DISCORD:INVITE_URL') != null) ?: null); $this->migrator->add('discord.role_id', ($this->getOldValue('SETTINGS::DISCORD:ROLE_ID') != null) ?: null); diff --git a/database/settings/2023_02_01_182158_create_website_settings.php b/database/settings/2023_02_01_182158_create_website_settings.php index 310024b9..b5a1fba0 100644 --- a/database/settings/2023_02_01_182158_create_website_settings.php +++ b/database/settings/2023_02_01_182158_create_website_settings.php @@ -8,7 +8,6 @@ class CreateWebsiteSettings extends SettingsMigration public function up(): void { // Get the user-set configuration values from the old table. - $this->migrator->add('website.', ($this->getOldValue('SETTINGS::') != null) ?: ''); $this->migrator->add('website.motd_enabled', ($this->getOldValue("SETTINGS::SYSTEM:MOTD_ENABLED") != null) ?: true); $this->migrator->add('website.motd_message', ($this->getOldValue("SETTINGS::SYSTEM:MOTD_MESSAGE") != null) ?: '

Controlpanel.gg