mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-24 10:17:15 +08:00
deployment
This commit is contained in:
parent
1428f2c14b
commit
635469f653
@ -9,5 +9,4 @@ RUN chmod +x /init_portainer
|
|||||||
FROM portainer/portainer-ce:2.19.0
|
FROM portainer/portainer-ce:2.19.0
|
||||||
LABEL maintainer="websoft9<help@websoft9.com>"
|
LABEL maintainer="websoft9<help@websoft9.com>"
|
||||||
LABEL version="2.19.0"
|
LABEL version="2.19.0"
|
||||||
|
|
||||||
COPY --from=builder /init_portainer /
|
COPY --from=builder /init_portainer /
|
@ -7,7 +7,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -42,7 +41,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err := readPasswordFromFile(filePath)
|
content, err := ioutil.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("read file error:", err)
|
fmt.Println("read file error:", err)
|
||||||
return
|
return
|
||||||
@ -75,26 +74,7 @@ func generatePassword(length int) string {
|
|||||||
return string(password)
|
return string(password)
|
||||||
}
|
}
|
||||||
|
|
||||||
func readPasswordFromFile(filePath string) (string, error) {
|
func writeToFile(filePath , content string) error {
|
||||||
data, err := ioutil.ReadFile(filePath)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
var passwordMap map[string]string
|
|
||||||
err = json.Unmarshal(data, &passwordMap)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
password := passwordMap["password"]
|
|
||||||
return password, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func writeToFile(filePath, password string) error {
|
return ioutil.WriteFile(filePath , []byte(content), 0755)
|
||||||
data := map[string]string{"username": "admin", "password": password}
|
|
||||||
jsonData, err := json.Marshal(data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ioutil.WriteFile(filePath, jsonData, 0755)
|
|
||||||
return err
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user