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

chore: standardize env var name to be MOMENTO_API_KEY #180

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ jobs:
# needs: release
# env:
# MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
# # TODO: get rid of this once everything has been migrated to MOMENTO_API_KEY
# TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# steps:
# - uses: actions/checkout@v2
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
runs-on: macos-latest
env:
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
# TODO: get rid of this once everything has been migrated to MOMENTO_API_KEY
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}

steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async fn demo_cache_usage() {

## Running Tests ⚡

Doc and integration tests require an auth token for testing. Set the env var `TEST_AUTH_TOKEN` to
Doc and integration tests require an auth token for testing. Set the env var `MOMENTO_API_KEY` to
provide it.

Running unit tests:
Expand All @@ -90,13 +90,13 @@ cargo test --lib
Running doc tests:

```
TEST_AUTH_TOKEN=<auth token> cargo test --doc
MOMENTO_API_KEY=<auth token> cargo test --doc
```

Running integration tests:

```
TEST_AUTH_TOKEN=<auth token> cargo test --tests
MOMENTO_API_KEY=<auth token> cargo test --tests
```

## Development 🔨
Expand Down
16 changes: 8 additions & 8 deletions src/credential_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ impl CredentialProviderBuilder {
/// ```
/// # tokio_test::block_on(async {
/// use momento::CredentialProviderBuilder;
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// # })
/// ```
///
Expand Down Expand Up @@ -122,10 +122,10 @@ impl CredentialProviderBuilder {
/// ```
/// # tokio_test::block_on(async {
/// use momento::CredentialProviderBuilder;
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .with_cache_endpoint("my_cache_endpoint.com".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// assert_eq!("https://my_cache_endpoint.com", credential_provider.cache_endpoint);
/// # })
/// ```
Expand All @@ -144,10 +144,10 @@ impl CredentialProviderBuilder {
/// ```
/// # tokio_test::block_on(async {
/// use momento::CredentialProviderBuilder;
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .with_control_endpoint("my_control_endpoint.com".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// assert_eq!("https://my_control_endpoint.com", credential_provider.control_endpoint);
/// # })
/// ```
Expand All @@ -166,10 +166,10 @@ impl CredentialProviderBuilder {
/// ```
/// # tokio_test::block_on(async {
/// use momento::CredentialProviderBuilder;
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .with_momento_endpoint("my_endpoint.com".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// assert_eq!("https://cache.my_endpoint.com", credential_provider.cache_endpoint);
/// assert_eq!("https://control.my_endpoint.com", credential_provider.control_endpoint);
/// # })
Expand Down
16 changes: 8 additions & 8 deletions src/simple_cache_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ impl SimpleCacheClientBuilder {
/// # tokio_test::block_on(async {
/// use momento::{CredentialProviderBuilder, SimpleCacheClientBuilder};
/// use std::time::Duration;
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// let momento = SimpleCacheClientBuilder::new(credential_provider, Duration::from_secs(30))
/// .expect("could not create a client")
/// .build();
Expand Down Expand Up @@ -284,9 +284,9 @@ impl SimpleCacheClient {
/// use std::time::Duration;
/// use momento::{CredentialProviderBuilder, SimpleCacheClientBuilder};
///
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// let cache_name = "rust-sdk-".to_string() + &Uuid::new_v4().to_string();
/// let mut momento = SimpleCacheClientBuilder::new(credential_provider, Duration::from_secs(5))?
/// .build();
Expand Down Expand Up @@ -318,9 +318,9 @@ impl SimpleCacheClient {
/// use std::time::Duration;
/// use momento::{CredentialProviderBuilder, SimpleCacheClientBuilder};
///
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// let cache_name = "rust-sdk-".to_string() + &Uuid::new_v4().to_string();
/// let mut momento = SimpleCacheClientBuilder::new(credential_provider, Duration::from_secs(5))?
/// .build();
Expand Down Expand Up @@ -424,9 +424,9 @@ impl SimpleCacheClient {
/// use momento::{CredentialProviderBuilder, SimpleCacheClientBuilder};
///
/// let ttl_minutes = 10;
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
/// let credential_provider = CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
/// .build()
/// .expect("TEST_AUTH_TOKEN must be set");
/// .expect("MOMENTO_API_KEY must be set");
/// let mut momento = SimpleCacheClientBuilder::new(credential_provider, Duration::from_secs(5))?
/// .build();
///
Expand Down
4 changes: 2 additions & 2 deletions test-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ where

let cache_name = "rust-sdk-".to_string() + &Uuid::new_v4().to_string();
let credential_provider =
CredentialProviderBuilder::from_environment_variable("TEST_AUTH_TOKEN".to_string())
CredentialProviderBuilder::from_environment_variable("MOMENTO_API_KEY".to_string())
.build()
.expect("TEST_AUTH_TOKEN must be set");
.expect("MOMENTO_API_KEY must be set");

let mut client =
SimpleCacheClientBuilder::new(credential_provider.clone(), Duration::from_secs(5))?.build();
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod tests {
}

fn get_momento_instance() -> SimpleCacheClient {
let auth_token = env::var("TEST_AUTH_TOKEN").expect("env var TEST_AUTH_TOKEN must be set");
let auth_token = env::var("MOMENTO_API_KEY").expect("env var MOMENTO_API_KEY must be set");
get_momento_instance_with_token(auth_token)
.expect("failed to build an integration test client builder")
.build()
Expand Down
Loading