2024-05-13 07:55:22 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"os/user"
|
|
|
|
)
|
|
|
|
|
|
|
|
var mongo_base_path = "/opt/my-mongo"
|
|
|
|
var replicaset_name = "techtransthai-db"
|
|
|
|
var network_name = "mongonet"
|
|
|
|
var number_of_containers int = 5
|
|
|
|
var max_mem_alloc_percent int = 95
|
|
|
|
var mongo_initdb_root_username = "sasha"
|
|
|
|
var mongo_initdb_root_password = "12345"
|
|
|
|
|
|
|
|
func check_root() {
|
|
|
|
currentUser, err := user.Current()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error getting current user:", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
if currentUser.Uid != "0" {
|
|
|
|
fmt.Println("You must be root to run this script")
|
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
fmt.Println("UID:", currentUser.Uid)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
check_root()
|
|
|
|
}
|