fix: update configuration files to use YAML format and adjust references in deployment
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
certs/*
|
certs/*
|
||||||
helloapp
|
helloapp
|
||||||
.*-config.json
|
.*-config.json
|
||||||
|
.*-config.yaml
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"server": {
|
|
||||||
"port": 8800
|
|
||||||
},
|
|
||||||
"certs": {
|
|
||||||
"testKeyPath": "./certs/test.key"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
4
.linux-config-template.yaml
Normal file
4
.linux-config-template.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
server:
|
||||||
|
port: 8800
|
||||||
|
certs:
|
||||||
|
testKeyPath: ./certs/test.key # 需要和 deployment.yaml 中的路径保持一致, 并且 certs 目录需要挂载 secret
|
||||||
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@@ -11,7 +11,6 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mode": "auto",
|
"mode": "auto",
|
||||||
"program": "${workspaceFolder}",
|
"program": "${workspaceFolder}",
|
||||||
"args": ["-f", ".linux-config.json"]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -43,9 +43,9 @@ spec:
|
|||||||
- name: config-volume
|
- name: config-volume
|
||||||
mountPath: /config
|
mountPath: /config
|
||||||
- name: helloapp-test-key
|
- name: helloapp-test-key
|
||||||
mountPath: /certs
|
mountPath: /certs/test.key
|
||||||
command: ["/helloapp"]
|
command: ["/helloapp"]
|
||||||
args: ["-f", "/config/.linux-config.json"]
|
args: ["-f", "/config/.linux-config.yaml"]
|
||||||
volumes:
|
volumes:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
@@ -60,12 +60,8 @@ metadata:
|
|||||||
name: k8s-example-config
|
name: k8s-example-config
|
||||||
namespace: helloapp
|
namespace: helloapp
|
||||||
data:
|
data:
|
||||||
.linux-config.json: |
|
.linux-config.yaml: |
|
||||||
{
|
server:
|
||||||
"server": {
|
port: 8800
|
||||||
"port": 8800
|
certs:
|
||||||
},
|
testKeyPath: /certs/test.key
|
||||||
"certs": {
|
|
||||||
"testKeyPath": "./certs/test.key"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
main.go
2
main.go
@@ -17,7 +17,7 @@ var (
|
|||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// read -f parameter (config file)
|
// read -f parameter (config file)
|
||||||
configPath := flag.String("f", ".linux-config.json", "config file")
|
configPath := flag.String("f", ".linux-config.yaml", "config file")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
conf.Init(*configPath)
|
conf.Init(*configPath)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user