add user and pass for world to env variables
This commit is contained in:
@@ -7,12 +7,12 @@ import (
|
||||
"log/slog"
|
||||
"net/http/cookiejar"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry"
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/requests"
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/transport"
|
||||
"gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/types"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
@@ -95,10 +95,19 @@ func (app *application) parseFlags() *transport.FoundryTransportData {
|
||||
flag.StringVar(&logLevelStr, "log_level", "info", "Password to connect to Foundry(debug|info|warn|error)")
|
||||
|
||||
var worlds string
|
||||
flag.StringVar(&worlds, "foundry-worlds", "", "Worlds that initialize in db on startup")
|
||||
flag.StringVar(&worlds, "foundry-worlds", "", "Worlds that initialize in db on startup (format: \"test\", \"test1,test2,test3\", \"test1,test2,test3\")")
|
||||
var users string
|
||||
flag.StringVar(&users, "world-user", "", "Usernames to authenticate the world (format: \"test\", \"test1,test2,test3\", \"testForAll\")")
|
||||
var passwords string
|
||||
flag.StringVar(&passwords, "world-pass", "", "Passwords to authenticate the world (format: \"test\", \"test1,test2,test3\", \"testForAll\")")
|
||||
flag.Parse()
|
||||
|
||||
foundryTransportData.Worlds = strings.Split(worlds, ",")
|
||||
worldsData, err := types.CreateWorldDataSlice(worlds, users, passwords)
|
||||
if err != nil {
|
||||
app.slogger.Warn("Got err on parsing authentication world data", "err", err)
|
||||
return nil
|
||||
}
|
||||
foundryTransportData.Worlds = worldsData
|
||||
|
||||
app.cfg.mode = service_mode(mode)
|
||||
|
||||
@@ -120,6 +129,10 @@ func main() {
|
||||
app := application{foundryApp: &foundry.FoundryApi{}}
|
||||
|
||||
foundryTransportData := app.parseFlags()
|
||||
if foundryTransportData == nil {
|
||||
return
|
||||
}
|
||||
|
||||
jar, err := cookiejar.New(nil)
|
||||
if err != nil {
|
||||
app.slogger.Error("Error", "text", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user