ElfSundae / laravel-hashid

Obfuscate your data by generating reversible, non-sequential, URL-safe identifiers.
MIT License
407 stars 36 forks source link

hashid:optimus output as .env format #21

Closed ghost closed 4 years ago

ghost commented 4 years ago

hashid:optimus now output as a table. User need to manually copy each number and put it into configuration files. If it output as the same format as .env will allow user to just copy-paste whole contents.

ElfSundae commented 4 years ago

Thanks for your PR, but I'd like to keep it. This command generates several numbers, not just for env use, and OPTIMUS_PRIME ENV keys are demo examples, the user may define different keys for different connections.

$ php artisan hashid:optimus -t 5
+------------+------------+------------+
| prime      | inverse    | random     |
+------------+------------+------------+
| 686622553  | 1059901673 | 1440559175 |
| 252634223  | 1594292879 | 1093781437 |
| 1257235009 | 740371905  | 2095833341 |
| 1587806809 | 286991849  | 1661514328 |
| 1748518507 | 1006712387 | 244393834  |
+------------+------------+------------+
'connections' => [
    'postKey' => [
        'driver' => 'optimus',
        'prime' => 988726573,
        'inverse' => 827118245,
        'random' => 846949023,
    ],

    'postID' => [
        'driver' => 'optimus',
        'prime' => env('OPTIMUS_PRIME_POSTID'),
        'inverse' => env('OPTIMUS_INVERSE_POSTID'),
        'random' => env('OPTIMUS_RANDOM_POSTID', 0),
    ],
],