firefly-iii/app/Support/System/GeneratesInstallationId.php

29 lines
651 B
PHP
Raw Normal View History

2020-06-05 23:57:44 -05:00
<?php
declare(strict_types=1);
namespace FireflyIII\Support\System;
use Log;
use Ramsey\Uuid\Uuid;
/**
* Trait GeneratesInstallationId
*/
trait GeneratesInstallationId
{
/**
*
*/
protected function generateInstallationId(): void
{
$config = app('fireflyconfig')->get('installation_id', null);
if (null === $config) {
$uuid5 = Uuid::uuid5(Uuid::NAMESPACE_URL, 'firefly-iii.org');
$uniqueId = (string) $uuid5;
Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId));
app('fireflyconfig')->set('installation_id', $uniqueId);
}
}
}