「✨」 feat: Finished wordpress/php container
This commit is contained in:
23
srcs/internal/env/env_set.go
vendored
Normal file
23
srcs/internal/env/env_set.go
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func IsEnvSet(what string) bool {
|
||||
env := os.Environ()
|
||||
|
||||
reg, err := regexp.Compile("^" + what)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, v := range env {
|
||||
if reg.MatchString(v) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
19
srcs/internal/pass/genStr.go
Normal file
19
srcs/internal/pass/genStr.go
Normal file
@ -0,0 +1,19 @@
|
||||
package pass
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GenStrPass(n int) string {
|
||||
var characters = []rune("abcdef0123456789")
|
||||
var sb strings.Builder
|
||||
|
||||
for i := 0; i < n; i++ {
|
||||
randomIndex := rand.Intn(len(characters))
|
||||
randomChar := characters[randomIndex]
|
||||
sb.WriteRune(randomChar)
|
||||
}
|
||||
|
||||
return sb.String()
|
||||
}
|
Reference in New Issue
Block a user