「🏗️」 wip: work in progress, not done yet.
This commit is contained in:
@ -8,7 +8,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
"git.keyzox.me/42_adjoly/inception/internal/env"
|
|
||||||
"git.keyzox.me/42_adjoly/inception/internal/log"
|
"git.keyzox.me/42_adjoly/inception/internal/log"
|
||||||
"git.keyzox.me/42_adjoly/inception/internal/pass"
|
"git.keyzox.me/42_adjoly/inception/internal/pass"
|
||||||
)
|
)
|
||||||
@ -50,23 +49,25 @@ func main() {
|
|||||||
|
|
||||||
makeFpmConf()
|
makeFpmConf()
|
||||||
|
|
||||||
_, err := os.ReadFile("/var/www/html/wp-config.php")
|
_, err := os.ReadFile("/usr/src/wordpress/wp-config.php")
|
||||||
|
|
||||||
if err != nil && env.IsEnvSet("WORDPRESS_") {
|
if err != nil {
|
||||||
content, err := os.ReadFile("/var/www/html/wp-config-docker.php")
|
_log.Log("note", "Configuring wordpress...")
|
||||||
|
content, err := os.ReadFile("/usr/src/wordpress/wp-config-docker.php")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
res := bytes.Replace([]byte(content), []byte("put your unique phrase here"), []byte(pass.GenStrPass(32)), -1)
|
res := bytes.Replace([]byte(content), []byte("put your unique phrase here"), []byte(pass.GenStrPass(32)), -1)
|
||||||
if err := os.WriteFile("/var/www/html/wp-config.php", res, 0660); err != nil {
|
if err := os.WriteFile("/usr/src/wordpress/wp-config.php", res, 0660); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
cmd := exec.Command("chown", "www-data:www-data", "/var/www/html/wp-config.php")
|
cmd := exec.Command("chown", "www-data:www-data", "/usr/src/wordpress/wp-config.php")
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
if err := cmd.Run(); err == nil {
|
if err := cmd.Run(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
_log.Log("note", "wp configured")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ COPY go.mod /build/go.mod
|
|||||||
COPY cmd /build/cmd
|
COPY cmd /build/cmd
|
||||||
COPY internal /build/internal
|
COPY internal /build/internal
|
||||||
COPY docker/wordpress/www-docker.conf /www-docker.conf
|
COPY docker/wordpress/www-docker.conf /www-docker.conf
|
||||||
|
COPY docker/wordpress/wp-config-docker.php /usr/src/wordpress/wp-config-docker.php
|
||||||
|
|
||||||
RUN apk add --no-cache go curl php84-mysqli php84-fpm tzdata fcgi \
|
RUN apk add --no-cache go curl php84-mysqli php84-fpm tzdata fcgi \
|
||||||
&& cd /build \
|
&& cd /build \
|
||||||
|
Reference in New Issue
Block a user