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 configure Basic Auth with Symfony #201

Open
xvilo opened this issue Nov 25, 2024 · 1 comment
Open

How to configure Basic Auth with Symfony #201

xvilo opened this issue Nov 25, 2024 · 1 comment

Comments

@xvilo
Copy link

xvilo commented Nov 25, 2024

Hi,

I couldn't find it in the documentation, but what would be the prefered way to configure basic auth for the elastic search endpoint when using the Symfony configuration?

Currently I'm using the provided example mainly:

elastically:
  connections:
    # You can create multiple clients
    default:
      # Any Elastica option works here
      client:
        hosts:
          - 'es.example.com'

      # Path to the mapping directory (in YAML)
      mapping_directory: '%kernel.project_dir%/config/elasticsearch'

      # Size of the bulk sent to Elasticsearch (default to 100)
      bulk_size: 100

      # If you want to add a prefix for your index in elasticsearch (you can still call it by its base name everywhere!)
      prefix: '%kernel.environment%'

      # Use HttpClient component
      transport_config:
        http_client: 'Psr\Http\Client\ClientInterface'

But I'm unsure as to where to configure the username and password

@damienalexandre
Copy link
Member

Hello,

According to Elastica it's in the config, so put it inside "client".

https://github.com/ruflin/Elastica/blob/58042887616eeb63621412c03bc903056bbcee7e/src/Client.php#L599-L601

elastically:
  connections:
    # You can create multiple clients
    default:
      # Any Elastica option works here
      client:
        hosts:
          - 'es.example.com'
        username: xoxo
        password: secret

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

2 participants