mirror of
https://github.com/amigan/aim-oscar-server.git
synced 2024-11-21 03:59:47 -05:00
Why the hell...
This commit is contained in:
parent
060650a7aa
commit
64f7831fe1
4 changed files with 20 additions and 6 deletions
|
@ -21,6 +21,7 @@ var (
|
|||
DB_URL = ""
|
||||
DB_USER = ""
|
||||
DB_PASSWORD = ""
|
||||
DB_NAME = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -36,6 +37,10 @@ func init() {
|
|||
DB_PASSWORD = strings.TrimSpace(dbPassword)
|
||||
}
|
||||
|
||||
if dbName, ok := os.LookupEnv("DB_NAME"); ok {
|
||||
DB_NAME = strings.TrimSpace(dbName)
|
||||
}
|
||||
|
||||
if len(os.Args) != 2 {
|
||||
log.Fatalf("Usage: %s <init|up|down|status|mark_applied>", os.Args[0])
|
||||
}
|
||||
|
@ -48,7 +53,7 @@ func main() {
|
|||
pgdriver.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}),
|
||||
pgdriver.WithUser(DB_USER),
|
||||
pgdriver.WithPassword(DB_PASSWORD),
|
||||
pgdriver.WithDatabase("postgres"),
|
||||
pgdriver.WithDatabase(DB_NAME),
|
||||
pgdriver.WithInsecure(true),
|
||||
pgdriver.WithTimeout(5*time.Second),
|
||||
pgdriver.WithDialTimeout(5*time.Second),
|
||||
|
|
1
env/example.dev.env
vendored
1
env/example.dev.env
vendored
|
@ -3,4 +3,5 @@ export POSTGRES_PASSWORD=password
|
|||
export DB_URL="$(hostname):5432"
|
||||
export DB_USER=${POSTGRES_USER}
|
||||
export DB_PASSWORD=${POSTGRES_PASSWORD}
|
||||
export DB_NAME=oscar
|
||||
export OSCAR_BOS_HOST=$(osascript -e "IPv4 address of (system info)")
|
||||
|
|
11
main.go
11
main.go
|
@ -36,6 +36,7 @@ var (
|
|||
DB_URL = ""
|
||||
DB_USER = ""
|
||||
DB_PASSWORD = ""
|
||||
DB_NAME = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -75,6 +76,10 @@ func init() {
|
|||
DB_PASSWORD = strings.TrimSpace(dbPassword)
|
||||
}
|
||||
|
||||
if dbName, ok := os.LookupEnv("DB_NAME"); ok {
|
||||
DB_NAME = strings.TrimSpace(dbName)
|
||||
}
|
||||
|
||||
flag.Parse()
|
||||
|
||||
OSCAR_HOST = oscarHost
|
||||
|
@ -96,6 +101,10 @@ func init() {
|
|||
if DB_PASSWORD == "" {
|
||||
log.Fatalln("DB password not specified")
|
||||
}
|
||||
|
||||
if DB_NAME == "" {
|
||||
log.Fatalln("DB name not specified")
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -105,7 +114,7 @@ func main() {
|
|||
pgdriver.WithTLSConfig(&tls.Config{InsecureSkipVerify: true}),
|
||||
pgdriver.WithUser(DB_USER),
|
||||
pgdriver.WithPassword(DB_PASSWORD),
|
||||
pgdriver.WithDatabase("postgres"),
|
||||
pgdriver.WithDatabase(DB_NAME),
|
||||
pgdriver.WithInsecure(true),
|
||||
pgdriver.WithTimeout(5*time.Second),
|
||||
pgdriver.WithDialTimeout(5*time.Second),
|
||||
|
|
7
run.sh
7
run.sh
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
source env/dev.env
|
||||
npm install
|
||||
npm run dev
|
||||
. dev.env
|
||||
./aim-oscar
|
||||
|
|
Loading…
Reference in a new issue