Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The redis model config file is ignored #5

Closed
kornatzky opened this issue Apr 14, 2023 · 5 comments
Closed

The redis model config file is ignored #5

kornatzky opened this issue Apr 14, 2023 · 5 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@kornatzky
Copy link

With this config/redis-model.php

<?php

use Illuminate\Support\Str;

return [
    'redis_model_options' => [
        'database_default' => 'redis_model_default',
        'prefix' => env('REDIS_MODEL_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_redis_model_'),
    ],

    'commands' => [
        'generate_path' => app_path('RedisModels'),
        'rootNamespace' => 'App\\RedisModels',
    ],

    'database' => [
        'redis_model_default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'username' => env('REDIS_USERNAME'),
            'password' => env('REDIS_PASSWORD'),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', 'redis_model'),
        ],
    ],
];

and config/datbase.php containing,

        'redis_model' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', '2'),
        ],

with REDIS_DB not defined in .env

It just stores models in db 0 of Redis.

However when I set for a model the connectionName it works.

@alvin0
Copy link
Owner

alvin0 commented Apr 14, 2023

Thank you, this error will be addressed in the upcoming version 0.6.
I overlooked it because I thought it would be of little concern to most people.

@alvin0 alvin0 added the bug Something isn't working label Apr 14, 2023
@alvin0 alvin0 self-assigned this Apr 14, 2023
@alvin0 alvin0 added invalid This doesn't seem right and removed bug Something isn't working labels Apr 15, 2023
@alvin0
Copy link
Owner

alvin0 commented Apr 15, 2023

With this config/redis-model.php

<?php

use Illuminate\Support\Str;

return [
    'redis_model_options' => [
        'database_default' => 'redis_model_default',
        'prefix' => env('REDIS_MODEL_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_redis_model_'),
    ],

    'commands' => [
        'generate_path' => app_path('RedisModels'),
        'rootNamespace' => 'App\\RedisModels',
    ],

    'database' => [
        'redis_model_default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'username' => env('REDIS_USERNAME'),
            'password' => env('REDIS_PASSWORD'),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', 'redis_model'),
        ],
    ],
];

and config/datbase.php containing,

        'redis_model' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', '2'),
        ],

with REDIS_DB not defined in .env

It just stores models in db 0 of Redis.

However when I set for a model the connectionName it works.

I may have overlooked this information when researching Redis: "In Redis, the default number of databases is 16 and they are numbered from 0 to 15 (you can customize this with your Redis instance)." (https://www.digitalocean.com/community/cheatsheets/how-to-manage-redis-databases-and-keys)
I will customize the default database of the redis-model package back to the value 0 so that at least no one will be confused anymore.
Thank you for asking such a great question and providing me with this useful information.
Have a great day!

@kornatzky
Copy link
Author

Thanks for your attention.

@kornatzky
Copy link
Author

Will be publishing your package with warm recommendations on Twitter, LinkedIn and Facebook. Take care

@alvin0 alvin0 closed this as completed Apr 15, 2023
@alvin0
Copy link
Owner

alvin0 commented Apr 15, 2023

Will be publishing your package with warm recommendations on Twitter, LinkedIn and Facebook. Take care

Thank you for what you've done for me, it will be a great motivation for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants