update a few things

This commit is contained in:
Andras Bacsai 2023-08-23 16:40:59 +02:00
parent d62af76097
commit 2d8f166e4a
9 changed files with 44 additions and 29 deletions

View File

@ -17,7 +17,7 @@ public function cancel()
$response = Http::withHeaders([
'Accept' => 'application/vnd.api+json',
'Content-Type' => 'application/vnd.api+json',
'Authorization' => 'Bearer ' . config('coolify.lemon_squeezy_api_key'),
'Authorization' => 'Bearer ' . config('subscription.lemon_squeezy_api_key'),
])->delete('https://api.lemonsqueezy.com/v1/subscriptions/' . $subscription_id);
$json = $response->json();
if ($response->failed()) {
@ -44,7 +44,7 @@ public function resume()
$response = Http::withHeaders([
'Accept' => 'application/vnd.api+json',
'Content-Type' => 'application/vnd.api+json',
'Authorization' => 'Bearer ' . config('coolify.lemon_squeezy_api_key'),
'Authorization' => 'Bearer ' . config('subscription.lemon_squeezy_api_key'),
])->patch('https://api.lemonsqueezy.com/v1/subscriptions/' . $subscription_id, [
'data' => [
'type' => 'subscriptions',

View File

@ -16,11 +16,21 @@ protected static function booted()
ServerSetting::create([
'server_id' => $server->id,
]);
StandaloneDocker::create([
'name' => 'coolify',
'network' => 'coolify',
'server_id' => $server->id,
]);
if ($server->id === 0) {
StandaloneDocker::create([
'id' => 0,
'name' => 'coolify',
'network' => 'coolify',
'server_id' => $server->id,
]);
} else {
StandaloneDocker::create([
'name' => 'coolify',
'network' => 'coolify',
'server_id' => $server->id,
]);
}
});
static::deleting(function ($server) {
$server->settings()->delete();

View File

@ -14,9 +14,9 @@ public function team()
}
public function type()
{
$basic = explode(',', config('coolify.lemon_squeezy_basic_plan_ids'));
$pro = explode(',', config('coolify.lemon_squeezy_pro_plan_ids'));
$ultimate = explode(',', config('coolify.lemon_squeezy_ultimate_plan_ids'));
$basic = explode(',', config('subscription.lemon_squeezy_basic_plan_ids'));
$pro = explode(',', config('subscription.lemon_squeezy_pro_plan_ids'));
$ultimate = explode(',', config('subscription.lemon_squeezy_ultimate_plan_ids'));
$subscription = $this->lemon_variant_id;
if (in_array($subscription, $basic)) {

View File

@ -4,7 +4,7 @@
function getSubscriptionLink($type)
{
$checkout_id = config("coolify.lemon_squeezy_checkout_id_$type");
$checkout_id = config("subscription.lemon_squeezy_checkout_id_$type");
if (!$checkout_id) {
return null;
}

View File

@ -4,17 +4,6 @@
'self_hosted' => env('SELF_HOSTED', true),
'waitlist' => env('WAITLIST', false),
'license_url' => 'https://license.coolify.io',
'lemon_squeezy_api_key' => env('LEMON_SQUEEZY_API_KEY', null),
'lemon_squeezy_webhook_secret' => env('LEMON_SQUEEZY_WEBHOOK_SECRET', null),
'lemon_squeezy_checkout_id_monthly_basic' => env('LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY_BASIC', null),
'lemon_squeezy_checkout_id_monthly_pro' => env('LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY_PRO', null),
'lemon_squeezy_checkout_id_monthly_ultimate' => env('LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY_ULTIMATE', null),
'lemon_squeezy_checkout_id_yearly_basic' => env('LEMON_SQUEEZY_CHECKOUT_ID_YEARLY_BASIC', null),
'lemon_squeezy_checkout_id_yearly_pro' => env('LEMON_SQUEEZY_CHECKOUT_ID_YEARLY_PRO', null),
'lemon_squeezy_checkout_id_yearly_ultimate' => env('LEMON_SQUEEZY_CHECKOUT_ID_YEARLY_ULTIMATE', null),
'lemon_squeezy_basic_plan_ids' => env('LEMON_SQUEEZY_BASIC_PLAN_IDS', ""),
'lemon_squeezy_pro_plan_ids' => env('LEMON_SQUEEZY_PRO_PLAN_IDS', ""),
'lemon_squeezy_ultimate_plan_ids' => env('LEMON_SQUEEZY_ULTIMATE_PLAN_IDS', ""),
'mux_enabled' => env('MUX_ENABLED', true),
'dev_webhook' => env('SERVEO_URL'),
'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'),

15
config/subscription.php Normal file
View File

@ -0,0 +1,15 @@
<?php
return [
'lemon_squeezy_api_key' => env('LEMON_SQUEEZY_API_KEY', null),
'lemon_squeezy_webhook_secret' => env('LEMON_SQUEEZY_WEBHOOK_SECRET', null),
'lemon_squeezy_checkout_id_monthly_basic' => env('LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY_BASIC', null),
'lemon_squeezy_checkout_id_monthly_pro' => env('LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY_PRO', null),
'lemon_squeezy_checkout_id_monthly_ultimate' => env('LEMON_SQUEEZY_CHECKOUT_ID_MONTHLY_ULTIMATE', null),
'lemon_squeezy_checkout_id_yearly_basic' => env('LEMON_SQUEEZY_CHECKOUT_ID_YEARLY_BASIC', null),
'lemon_squeezy_checkout_id_yearly_pro' => env('LEMON_SQUEEZY_CHECKOUT_ID_YEARLY_PRO', null),
'lemon_squeezy_checkout_id_yearly_ultimate' => env('LEMON_SQUEEZY_CHECKOUT_ID_YEARLY_ULTIMATE', null),
'lemon_squeezy_basic_plan_ids' => env('LEMON_SQUEEZY_BASIC_PLAN_IDS', ""),
'lemon_squeezy_pro_plan_ids' => env('LEMON_SQUEEZY_PRO_PLAN_IDS', ""),
'lemon_squeezy_ultimate_plan_ids' => env('LEMON_SQUEEZY_ULTIMATE_PLAN_IDS', ""),
];

View File

@ -16,6 +16,7 @@ public function run(): void
InstanceSettings::create([
'id' => 0,
'is_registration_enabled' => true,
'is_resale_license_active' => true,
'smtp_enabled' => true,
'smtp_host' => 'coolify-mail',
'smtp_port' => 1025,

View File

@ -13,11 +13,11 @@ class StandaloneDockerSeeder extends Seeder
*/
public function run(): void
{
StandaloneDocker::create([
'id' => 0,
'name' => 'Standalone Docker 1',
'network' => 'coolify',
'server_id' => 0,
]);
// StandaloneDocker::create([
// 'id' => 0,
// 'name' => 'Standalone Docker 1',
// 'network' => 'coolify',
// 'server_id' => 0,
// ]);
}
}

View File

@ -208,7 +208,7 @@
})->name('webhooks.waitlist.cancel');
Route::post('/payments/events', function () {
try {
$secret = config('coolify.lemon_squeezy_webhook_secret');
$secret = config('subscription.lemon_squeezy_webhook_secret');
$payload = request()->collect();
$hash = hash_hmac('sha256', $payload, $secret);
$signature = request()->header('X-Signature');