diff --git a/docs/en/start/secret/start.md b/docs/en/start/secret/start.md index cc25d21770..77633fd6b6 100644 --- a/docs/en/start/secret/start.md +++ b/docs/en/start/secret/start.md @@ -30,6 +30,8 @@ Once finished, the layotto file will be generated in the directory, run it: ``` ### Step 2: Run the client program and call Layotto to get the secret + +### **Go** ```shell cd ${project_path}/demo/secret/common/ @@ -50,6 +52,39 @@ data:{key:"db-user-pass:password" value:"S!S*d$zDsb="} data:{key:"db-user-pass:password" value:{secrets:{key:"db-user-pass:password" value:"S!S*d$zDsb="}}} data:{key:"db-user-pass:username" value:{secrets:{key:"db-user-pass:username" value:"devuser"}}} ``` +### **Java** +Download java sdk and examples: + +```shell @if.not.exist java-sdk +git clone https://github.com/layotto/java-sdk +``` + +Change directory: + +```shell +cd java-sdk +``` + +Build: + +```shell @if.not.exist examples-secret/target/examples-secret-jar-with-dependencies.jar +# build example jar +mvn -f examples-secret/pom.xml clean package +``` + +Run the examples: + +```shell +java -jar examples-secret/target/examples-secret-jar-with-dependencies.jar +``` + +And you will see: + +```bash +{db-user-pass:password=S!S*d$zDsb=} +{redisPassword={redisPassword=redis123}, db-user-pass:password={db-user-pass:password=S!S*d$zDsb=}, db-user-pass:username={db-user-pass:username=devuser}} +``` + ## Want to learn more about Secret API? Layotto reuse Dapr Secret API,learn more:https://docs.dapr.io/operations/components/setup-secret-store/ diff --git a/docs/zh/start/secret/start.md b/docs/zh/start/secret/start.md index aa4778c675..3ebb0b5598 100644 --- a/docs/zh/start/secret/start.md +++ b/docs/zh/start/secret/start.md @@ -29,6 +29,8 @@ go build -o layotto ``` ### 第二步:运行客户端程序,调用 Layotto 获取 secret + +### **Go** ```shell cd ${project_path}/demo/secret/common/ @@ -49,6 +51,38 @@ data:{key:"db-user-pass:password" value:"S!S*d$zDsb="} data:{key:"db-user-pass:password" value:{secrets:{key:"db-user-pass:password" value:"S!S*d$zDsb="}}} data:{key:"db-user-pass:username" value:{secrets:{key:"db-user-pass:username" value:"devuser"}}} ``` +### **Java** +下载 java sdk 和示例代码: +```shell @if.not.exist java-sdk +git clone https://github.com/layotto/java-sdk +``` + +切换目录: + +```shell +cd java-sdk +``` + +构建: + +```shell @if.not.exist examples-secret/target/examples-secret-jar-with-dependencies.jar +# build example jar +mvn -f examples-secret/pom.xml clean package +``` + +运行: + +```shell +java -jar examples-secret/target/examples-secret-jar-with-dependencies.jar +``` + +打印出以下信息说明运行成功: + +```bash +{db-user-pass:password=S!S*d$zDsb=} +{redisPassword={redisPassword=redis123}, db-user-pass:password={db-user-pass:password=S!S*d$zDsb=}, db-user-pass:username={db-user-pass:username=devuser}} +``` + ## 想要详细了解Secret API? Layotto复用了Dapr的Secret API,了解更多:https://docs.dapr.io/operations/components/setup-secret-store/