schema migration and account fixes
very close to rolling this out! just need to address some security concerns first
This commit is contained in:
parent
5566a795da
commit
570cdf6ce2
20 changed files with 641 additions and 392 deletions
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
|
@ -57,13 +56,13 @@ var Config = func() config {
|
|||
|
||||
err = toml.Unmarshal([]byte(data), &config)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "FATAL: Failed to parse configuration file: %s\n", err.Error())
|
||||
fmt.Fprintf(os.Stderr, "FATAL: Failed to parse configuration file: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = handleConfigOverrides(&config)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "FATAL: Failed to parse environment variable %s\n", err.Error())
|
||||
fmt.Fprintf(os.Stderr, "FATAL: Failed to parse environment variable %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -92,30 +91,4 @@ func handleConfigOverrides(config *config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var Args = func() map[string]string {
|
||||
args := map[string]string{}
|
||||
|
||||
index := 0
|
||||
for index < len(os.Args[1:]) {
|
||||
arg := os.Args[index + 1]
|
||||
if !strings.HasPrefix(arg, "-") {
|
||||
fmt.Printf("FATAL: Parameters must follow an argument (%s).\n", arg)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if index + 3 > len(os.Args) || strings.HasPrefix(os.Args[index + 2], "-") {
|
||||
args[arg[1:]] = "true"
|
||||
index += 1
|
||||
continue
|
||||
}
|
||||
|
||||
val := os.Args[index + 2]
|
||||
args[arg[1:]] = val
|
||||
// fmt.Printf("%s: %s\n", arg[1:], val)
|
||||
index += 2
|
||||
}
|
||||
|
||||
return args
|
||||
}()
|
||||
|
||||
var DB *sqlx.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue