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

Cosmos State Store - Improve emulator usage - Component configuration #3404

Open
perokvist opened this issue Apr 26, 2024 · 2 comments
Open

Comments

@perokvist
Copy link

perokvist commented Apr 26, 2024

It would be create to either set more meta data, emulator mode, OR support connection strings.

When using the Aspire Cosmos component, I learnt that there are more parameters set through the connection string.

AccountKey=xxx;AccountEndpoint=https://127.0.0.1:65236;DisableServerCertificateValidation=True;

@perokvist perokvist added the kind/enhancement New feature or request label Apr 26, 2024
@berndverst
Copy link
Member

berndverst commented May 1, 2024

We use the Cosmos DB Azure SDK for Go. Take a look at their emulator tests: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/data/azcosmos/emulator_tests.go

It appears that simply specifying a host like https://localhost:8903/ end the masterKey (accountKey) for the emulator should work.

That's what the Azure SDK team does. They use this emulator: https://aka.ms/cosmosdb-emulator
And here is their script to launch the emulator: https://github.com/Azure/azure-sdk-for-go/blob/84361e7de430729bf174593eba3760b5422359be/eng/common/scripts/Cosmos-Emulator.ps1

The Dapr component lets you specify these properties.

Set the component metadata:

  - name: url
    value: https://localhost:65236
  - name: masterKey
    value: theaccountkey

This Azure SDK for Go does not have an option like DisableServerCertificateValidation

This SDK's method to provide a connection string only can extract accountKey and accountEndpoint from the connection string. So a connectionString option would not give you any additional functionality here. See for yourself:

https://github.com/Azure/azure-sdk-for-go/blob/84361e7de430729bf174593eba3760b5422359be/sdk/data/azcosmos/cosmos_client.go#L81

I believe the Go SDK can already work with the emulator, but given that the Azure SDK for Go does not have any further configuration options, Dapr cannot expand the support for the emulator.

You may consider filing a feature request at https://github.com/Azure/azure-sdk-for-go

@perokvist
Copy link
Author

perokvist commented May 3, 2024

The scenario I came across was when using the Aspire Cosmos component It uses https://hub.docker.com/r/microsoft/azure-cosmos-emulator-linux as it container for the emulator, that seems to have a certificate or the connectionString setting to work.

I'm guessing this will work with the dapr component if certificates are setup prior to running.

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

No branches or pull requests

2 participants