commit 8e368db0560b83a0b497cce86475b4b56d9b86df
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2023-09-23T15:33:01Z |
| subject | Skip create table in kstore-init if db exist |
commit 8e368db0560b83a0b497cce86475b4b56d9b86df
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2023-09-23T15:33:01Z
Skip create table in kstore-init if db exist
---
.gitignore | 1 +
bash/sources/16_keystore | 5 ++++-
bash/sources/17_kcontext | 4 ++--
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
index 78fd271..048446b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+.DS_Store
*.prod
*.log
diff --git a/bash/sources/16_keystore b/bash/sources/16_keystore
index 5305753..ed45d36 100644
--- a/bash/sources/16_keystore
+++ b/bash/sources/16_keystore
@@ -63,7 +63,8 @@ function kstore-secret {
}
function kstore-init {
- cat <<___SQL___ | $_SQLITE "$_AUTH_DB"
+ if [ ! -f "$_AUTH_DB" ]; then
+ cat <<___SQL___ | $_SQLITE "$_AUTH_DB"
CREATE TABLE IF NOT EXISTS store (
key TEXT NOT NULL
, prop TEXT NOT NULL
@@ -71,6 +72,8 @@ CREATE TABLE IF NOT EXISTS store (
, PRIMARY KEY( key ASC, prop ASC )
);
___SQL___
+ chmod 600 "$_AUTH_DB"
+ fi
kstore secret config
}
diff --git a/bash/sources/17_kcontext b/bash/sources/17_kcontext
index 6e311fb..180c1f0 100644
--- a/bash/sources/17_kcontext
+++ b/bash/sources/17_kcontext
@@ -14,8 +14,8 @@ function kcontext {
docker) shift; kcontext-docker "$@" ;;
s3-arch) shift; kcontext-s3-arch "$@" ;;
*)
- __func_help "k8s ..."
- __func_head "s3-arch ..."
+ __func_head "k8s ..."
+ __func_help "s3-arch ..."
__func_help "docker ..."
return 1
;;