use config instead of env()

This commit is contained in:
peaklabs-dev
2024-11-12 15:53:05 +01:00
parent 97f868a285
commit 1ffa88acf0
9 changed files with 37 additions and 31 deletions

View File

@@ -57,7 +57,7 @@ class Dev extends Command
{
// Generate APP_KEY if not exists
if (empty(env('APP_KEY'))) {
if (empty(config('app.key'))) {
echo "Generating APP_KEY.\n";
Artisan::call('key:generate');
}

View File

@@ -77,8 +77,8 @@ class Init extends Command
echo "Could not setup dynamic configuration: {$e->getMessage()}\n";
}
$settings = instanceSettings();
if (! is_null(env('AUTOUPDATE', null))) {
if (env('AUTOUPDATE') == true) {
if (! is_null(config('constants.coolify.autoupdate', null))) {
if (config('constants.coolify.autoupdate') == true) {
$settings->update(['is_auto_update_enabled' => true]);
} else {
$settings->update(['is_auto_update_enabled' => false]);

View File

@@ -57,7 +57,7 @@ class SyncBunny extends Command
PendingRequest::macro('storage', function ($fileName) use ($that) {
$headers = [
'AccessKey' => env('BUNNY_STORAGE_API_KEY'),
'AccessKey' => config('constants.bunny.storage_api_key'),
'Accept' => 'application/json',
'Content-Type' => 'application/octet-stream',
];
@@ -69,7 +69,7 @@ class SyncBunny extends Command
});
PendingRequest::macro('purge', function ($url) use ($that) {
$headers = [
'AccessKey' => env('BUNNY_API_KEY'),
'AccessKey' => config('constants.bunny.api_key'),
'Accept' => 'application/json',
];
$that->info('Purging: '.$url);

View File

@@ -359,7 +359,7 @@ function isDev(): bool
function isCloud(): bool
{
return ! config('constants.coolify.self_hosted');
return ! config('.self_hosted');
}
function translate_cron_expression($expression_to_validate): string
@@ -989,7 +989,7 @@ function generateEnvValue(string $command, Service|Application|null $service = n
function getRealtime()
{
$envDefined = env('PUSHER_PORT');
$envDefined = config('constants.pusher.port');
if (empty($envDefined)) {
$url = Url::fromString(Request::getSchemeAndHttpHost());
$port = $url->getPort();

View File

@@ -29,6 +29,7 @@ return [
'pusher' => [
'host' => env('PUSHER_HOST'),
'port' => env('PUSHER_PORT'),
'app_key' => env('PUSHER_APP_KEY'),
],
@@ -56,20 +57,6 @@ return [
],
],
'waitlist' => [
'enabled' => env('WAITLIST', true),
'expiration' => 10,
],
'sentry' => [
'sentry_dsn' => env('SENTRY_DSN'),
],
'webhooks' => [
'feedback_discord_webhook' => env('FEEDBACK_DISCORD_WEBHOOK'),
'dev_webhook' => env('SERVEO_URL'),
],
'limits' => [
'trial_period' => 0,
'server' => [
@@ -89,4 +76,23 @@ return [
'dynamic' => true,
],
],
'waitlist' => [
'enabled' => env('WAITLIST', true),
'expiration' => 10,
],
'sentry' => [
'sentry_dsn' => env('SENTRY_DSN'),
],
'webhooks' => [
'feedback_discord_webhook' => env('FEEDBACK_DISCORD_WEBHOOK'),
'dev_webhook' => env('SERVEO_URL'),
],
'bunny' => [
'storage_api_key' => env('BUNNY_STORAGE_API_KEY'),
'api_key' => env('BUNNY_API_KEY'),
],
];

View File

@@ -3,11 +3,11 @@
return [
// @see https://docs.sentry.io/product/sentry-basics/dsn-explainer/
'dsn' => config('coolify.sentry_dsn'),
'dsn' => config('constants.sentry.sentry_dsn'),
// The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.368',
'release' => config('constants.coolify.version'),
// When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'),

View File

@@ -84,9 +84,9 @@
window.Pusher = Pusher;
window.Echo = new Echo({
broadcaster: 'pusher',
cluster: "{{ env('PUSHER_HOST') }}" || window.location.hostname,
key: "{{ env('PUSHER_APP_KEY') }}" || 'coolify',
wsHost: "{{ env('PUSHER_HOST') }}" || window.location.hostname,
cluster: "{{ config('constants.pusher.host') }}" || window.location.hostname,
key: "{{ config('constants.pusher.app_key') }}" || 'coolify',
wsHost: "{{ config('constants.pusher.host') }}" || window.location.hostname,
wsPort: "{{ getRealtime() }}",
wssPort: "{{ getRealtime() }}",
forceTLS: false,

View File

@@ -26,9 +26,9 @@
<script>
// expose terminal config to the terminal.js file
window.terminalConfig = {
protocol: "{{ env('TERMINAL_PROTOCOL') }}",
host: "{{ env('TERMINAL_HOST') }}",
port: "{{ env('TERMINAL_PORT') }}"
protocol: "{{ config('constants.terminal.protocol') }}",
host: "{{ config('constants.terminal.host') }}",
port: "{{ config('constants.terminal.port') }}"
}
</script>
@endscript

View File

@@ -102,7 +102,7 @@
placeholder="1.1.1.1,8.8.8.8" />
<h4 class="pt-6">Update</h4>
<div class="text-right md:w-96">
@if (!is_null(env('AUTOUPDATE', null)))
@if (!is_null(config('constants.coolify.autoupdate', null)))
<div class="text-right md:w-96">
<x-forms.checkbox instantSave helper="AUTOUPDATE is set in .env file, you need to modify it there."
disabled id="is_auto_update_enabled" label="Enabled" />
@@ -119,7 +119,7 @@
<x-forms.button wire:click='checkManually'>Check Manually</x-forms.button>
</div>
@if (is_null(env('AUTOUPDATE', null)) && $is_auto_update_enabled)
@if (is_null(config('constants.coolify.autoupdate', null)) && $is_auto_update_enabled)
<x-forms.input required id="auto_update_frequency" label="Auto Update Frequency" placeholder="0 0 * * *"
helper="Cron expression for auto update frequency (automatically update coolify).<br>You can use every_minute, hourly, daily, weekly, monthly, yearly.<br><br>Default is every day at 00:00" />
@endif