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

How to set index_name for separate environments #70

Open
ringvold opened this issue Jun 14, 2024 · 0 comments
Open

How to set index_name for separate environments #70

ringvold opened this issue Jun 14, 2024 · 0 comments

Comments

@ringvold
Copy link

Hi,

I'm having some challenges figuring out how to handle multiple indices for different environments and looking for some tips.

As index_name is a part of the configuration when using the Algoliax.Indexer macro the index name needs to be set at compile time. Often variables that can differ between environments are set as environment variables at startup/runtime as one would have a separate index for each environment.

For now I have used if(Mix.env() == :prod, do: :prod_index_name, else: :dev_index_name) which is fine for a while but when we need to introduce a staging environment which would have the same mix env as production.

I hoped there was a way to do this with environment variables but I cant see how as it is required at compile time.

One alternative would be to create one module per environment and use config to select between them but I hoped it would be a better way to handle it.

Does anyone use this library with multiple environments and different index names or have any tips of how to handle this?

Are there any plans to change this or would you consider changing how index_names can be provided to support using environment variables?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant