mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-23 06:30:05 +00:00
feat: add GcsConfig credential field (#4568)
This commit is contained in:
@@ -18,6 +18,7 @@ GT_AZBLOB_ENDPOINT=AZBLOB endpoint
|
|||||||
GT_GCS_BUCKET = GCS bucket
|
GT_GCS_BUCKET = GCS bucket
|
||||||
GT_GCS_SCOPE = GCS scope
|
GT_GCS_SCOPE = GCS scope
|
||||||
GT_GCS_CREDENTIAL_PATH = GCS credential path
|
GT_GCS_CREDENTIAL_PATH = GCS credential path
|
||||||
|
GT_GCS_CREDENTIAL = GCS credential
|
||||||
GT_GCS_ENDPOINT = GCS end point
|
GT_GCS_ENDPOINT = GCS end point
|
||||||
# Settings for kafka wal test
|
# Settings for kafka wal test
|
||||||
GT_KAFKA_ENDPOINTS = localhost:9092
|
GT_KAFKA_ENDPOINTS = localhost:9092
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
| `storage.account_key` | String | `None` | The account key of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
| `storage.account_key` | String | `None` | The account key of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
||||||
| `storage.scope` | String | `None` | The scope of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
| `storage.scope` | String | `None` | The scope of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
||||||
| `storage.credential_path` | String | `None` | The credential path of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
| `storage.credential_path` | String | `None` | The credential path of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
||||||
|
| `storage.credential` | String | `None` | The credential of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
||||||
| `storage.container` | String | `None` | The container of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
| `storage.container` | String | `None` | The container of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
||||||
| `storage.sas_token` | String | `None` | The sas token of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
| `storage.sas_token` | String | `None` | The sas token of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
||||||
| `storage.endpoint` | String | `None` | The endpoint of the S3 service.<br/>**It's only used when the storage type is `S3`, `Oss`, `Gcs` and `Azblob`**. |
|
| `storage.endpoint` | String | `None` | The endpoint of the S3 service.<br/>**It's only used when the storage type is `S3`, `Oss`, `Gcs` and `Azblob`**. |
|
||||||
@@ -387,6 +388,7 @@
|
|||||||
| `storage.account_key` | String | `None` | The account key of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
| `storage.account_key` | String | `None` | The account key of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
||||||
| `storage.scope` | String | `None` | The scope of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
| `storage.scope` | String | `None` | The scope of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
||||||
| `storage.credential_path` | String | `None` | The credential path of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
| `storage.credential_path` | String | `None` | The credential path of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
||||||
|
| `storage.credential` | String | `None` | The credential of the google cloud storage.<br/>**It's only used when the storage type is `Gcs`**. |
|
||||||
| `storage.container` | String | `None` | The container of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
| `storage.container` | String | `None` | The container of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
||||||
| `storage.sas_token` | String | `None` | The sas token of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
| `storage.sas_token` | String | `None` | The sas token of the azure account.<br/>**It's only used when the storage type is `Azblob`**. |
|
||||||
| `storage.endpoint` | String | `None` | The endpoint of the S3 service.<br/>**It's only used when the storage type is `S3`, `Oss`, `Gcs` and `Azblob`**. |
|
| `storage.endpoint` | String | `None` | The endpoint of the S3 service.<br/>**It's only used when the storage type is `S3`, `Oss`, `Gcs` and `Azblob`**. |
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ backoff_deadline = "5mins"
|
|||||||
# root = "data"
|
# root = "data"
|
||||||
# scope = "test"
|
# scope = "test"
|
||||||
# credential_path = "123456"
|
# credential_path = "123456"
|
||||||
|
# credential = "base64-credential"
|
||||||
# endpoint = "https://storage.googleapis.com"
|
# endpoint = "https://storage.googleapis.com"
|
||||||
|
|
||||||
## The data storage options.
|
## The data storage options.
|
||||||
@@ -312,6 +313,11 @@ scope = "test"
|
|||||||
## +toml2docs:none-default
|
## +toml2docs:none-default
|
||||||
credential_path = "test"
|
credential_path = "test"
|
||||||
|
|
||||||
|
## The credential of the google cloud storage.
|
||||||
|
## **It's only used when the storage type is `Gcs`**.
|
||||||
|
## +toml2docs:none-default
|
||||||
|
credential= "base64-credential"
|
||||||
|
|
||||||
## The container of the azure account.
|
## The container of the azure account.
|
||||||
## **It's only used when the storage type is `Azblob`**.
|
## **It's only used when the storage type is `Azblob`**.
|
||||||
## +toml2docs:none-default
|
## +toml2docs:none-default
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ retry_delay = "500ms"
|
|||||||
# root = "data"
|
# root = "data"
|
||||||
# scope = "test"
|
# scope = "test"
|
||||||
# credential_path = "123456"
|
# credential_path = "123456"
|
||||||
|
# credential = "base64-credential"
|
||||||
# endpoint = "https://storage.googleapis.com"
|
# endpoint = "https://storage.googleapis.com"
|
||||||
|
|
||||||
## The data storage options.
|
## The data storage options.
|
||||||
@@ -357,6 +358,11 @@ scope = "test"
|
|||||||
## +toml2docs:none-default
|
## +toml2docs:none-default
|
||||||
credential_path = "test"
|
credential_path = "test"
|
||||||
|
|
||||||
|
## The credential of the google cloud storage.
|
||||||
|
## **It's only used when the storage type is `Gcs`**.
|
||||||
|
## +toml2docs:none-default
|
||||||
|
credential = "base64-credential"
|
||||||
|
|
||||||
## The container of the azure account.
|
## The container of the azure account.
|
||||||
## **It's only used when the storage type is `Azblob`**.
|
## **It's only used when the storage type is `Azblob`**.
|
||||||
## +toml2docs:none-default
|
## +toml2docs:none-default
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ pub struct GcsConfig {
|
|||||||
pub scope: String,
|
pub scope: String,
|
||||||
#[serde(skip_serializing)]
|
#[serde(skip_serializing)]
|
||||||
pub credential_path: SecretString,
|
pub credential_path: SecretString,
|
||||||
|
#[serde(skip_serializing)]
|
||||||
|
pub credential: SecretString,
|
||||||
pub endpoint: String,
|
pub endpoint: String,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub cache: ObjectStorageCacheConfig,
|
pub cache: ObjectStorageCacheConfig,
|
||||||
@@ -190,6 +192,7 @@ impl PartialEq for GcsConfig {
|
|||||||
&& self.bucket == other.bucket
|
&& self.bucket == other.bucket
|
||||||
&& self.scope == other.scope
|
&& self.scope == other.scope
|
||||||
&& self.credential_path.expose_secret() == other.credential_path.expose_secret()
|
&& self.credential_path.expose_secret() == other.credential_path.expose_secret()
|
||||||
|
&& self.credential.expose_secret() == other.credential.expose_secret()
|
||||||
&& self.endpoint == other.endpoint
|
&& self.endpoint == other.endpoint
|
||||||
&& self.cache == other.cache
|
&& self.cache == other.cache
|
||||||
}
|
}
|
||||||
@@ -243,6 +246,7 @@ impl Default for GcsConfig {
|
|||||||
bucket: String::default(),
|
bucket: String::default(),
|
||||||
scope: String::default(),
|
scope: String::default(),
|
||||||
credential_path: SecretString::from(String::default()),
|
credential_path: SecretString::from(String::default()),
|
||||||
|
credential: SecretString::from(String::default()),
|
||||||
endpoint: String::default(),
|
endpoint: String::default(),
|
||||||
cache: ObjectStorageCacheConfig::default(),
|
cache: ObjectStorageCacheConfig::default(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ pub(crate) async fn new_gcs_object_store(gcs_config: &GcsConfig) -> Result<Objec
|
|||||||
.bucket(&gcs_config.bucket)
|
.bucket(&gcs_config.bucket)
|
||||||
.scope(&gcs_config.scope)
|
.scope(&gcs_config.scope)
|
||||||
.credential_path(gcs_config.credential_path.expose_secret())
|
.credential_path(gcs_config.credential_path.expose_secret())
|
||||||
|
.credential(gcs_config.credential.expose_secret())
|
||||||
.endpoint(&gcs_config.endpoint)
|
.endpoint(&gcs_config.endpoint)
|
||||||
.http_client(build_http_client()?);
|
.http_client(build_http_client()?);
|
||||||
|
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ async fn test_gcs_backend() -> Result<()> {
|
|||||||
.bucket(&env::var("GT_GCS_BUCKET").unwrap())
|
.bucket(&env::var("GT_GCS_BUCKET").unwrap())
|
||||||
.scope(&env::var("GT_GCS_SCOPE").unwrap())
|
.scope(&env::var("GT_GCS_SCOPE").unwrap())
|
||||||
.credential_path(&env::var("GT_GCS_CREDENTIAL_PATH").unwrap())
|
.credential_path(&env::var("GT_GCS_CREDENTIAL_PATH").unwrap())
|
||||||
|
.credential(&env::var("GT_GCS_CREDENTIAL").unwrap())
|
||||||
.endpoint(&env::var("GT_GCS_ENDPOINT").unwrap());
|
.endpoint(&env::var("GT_GCS_ENDPOINT").unwrap());
|
||||||
|
|
||||||
let store = ObjectStore::new(builder).unwrap().finish();
|
let store = ObjectStore::new(builder).unwrap().finish();
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ pub fn get_test_store_config(store_type: &StorageType) -> (ObjectStoreConfig, Te
|
|||||||
bucket: env::var("GT_GCS_BUCKET").unwrap(),
|
bucket: env::var("GT_GCS_BUCKET").unwrap(),
|
||||||
scope: env::var("GT_GCS_SCOPE").unwrap(),
|
scope: env::var("GT_GCS_SCOPE").unwrap(),
|
||||||
credential_path: env::var("GT_GCS_CREDENTIAL_PATH").unwrap().into(),
|
credential_path: env::var("GT_GCS_CREDENTIAL_PATH").unwrap().into(),
|
||||||
|
credential: env::var("GT_GCS_CREDENTIAL").unwrap().into(),
|
||||||
endpoint: env::var("GT_GCS_ENDPOINT").unwrap(),
|
endpoint: env::var("GT_GCS_ENDPOINT").unwrap(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
@@ -169,6 +170,7 @@ pub fn get_test_store_config(store_type: &StorageType) -> (ObjectStoreConfig, Te
|
|||||||
.bucket(&gcs_config.bucket)
|
.bucket(&gcs_config.bucket)
|
||||||
.scope(&gcs_config.scope)
|
.scope(&gcs_config.scope)
|
||||||
.credential_path(gcs_config.credential_path.expose_secret())
|
.credential_path(gcs_config.credential_path.expose_secret())
|
||||||
|
.credential(gcs_config.credential.expose_secret())
|
||||||
.endpoint(&gcs_config.endpoint);
|
.endpoint(&gcs_config.endpoint);
|
||||||
|
|
||||||
let config = ObjectStoreConfig::Gcs(gcs_config);
|
let config = ObjectStoreConfig::Gcs(gcs_config);
|
||||||
|
|||||||
Reference in New Issue
Block a user