component/dis: Check if instance alive

This commit is contained in:
Tom Wiesing 2022-09-15 18:11:19 +02:00
parent 37cdd201f0
commit 492a0c0404
No known key found for this signature in database
8 changed files with 145 additions and 22 deletions

View file

@ -74,7 +74,11 @@ type Config struct {
// admin credentials for the Mysql database
MysqlAdminUser string `env:"MYSQL_ADMIN_USER" default:"admin" parser:"nonempty"`
MysqlAdminPassword string `env:"MYSQL_ADMIN_PASSWORD" default:"admin" parser:"nonempty"`
MysqlAdminPassword string `env:"MYSQL_ADMIN_PASSWORD" default:"" parser:"nonempty"`
// admin credentials for the dis server
DisAdminUser string `env:"DIS_ADMIN_USER" default:"admin" parser:"nonempty"`
DisAdminPassword string `env:"DIS_ADMIN_PASSWORD" default:"" parser:"nonempty"`
// ConfigPath is the path this configuration was loaded from (if any)
ConfigPath string

View file

@ -58,6 +58,10 @@ GLOBAL_AUTHORIZED_KEYS_FILE=${AUTHORIZED_KEYS_FILE}
GRAPHDB_ADMIN_USER=${GRAPHDB_ADMIN_USER}
GRAPHDB_ADMIN_PASSWORD=${GRAPHDB_ADMIN_PASSWORD}
# The admin password to use for access to mysql
# The admin user and password of the MySQL interface, to be used for provisioning
MYSQL_ADMIN_USER=${MYSQL_ADMIN_USER}
MYSQL_ADMIN_PASSWORD=${MYSQL_ADMIN_PASSWORD}
# The admin user and password required to access the /dis/ server and api
DIS_ADMIN_USER=${DIS_ADMIN_USER}
DIS_ADMIN_PASSWORD=${DIS_ADMIN_PASSWORD}

View file

@ -14,7 +14,7 @@ import (
_ "embed"
)
// Template is a template for the cofiguration file
// Template is a template for the configuration file
type Template struct {
DeployRoot string `env:"DEPLOY_ROOT"`
DefaultDomain string `env:"DEFAULT_DOMAIN"`
@ -24,6 +24,8 @@ type Template struct {
TriplestoreAdminPassword string `env:"GRAPHDB_ADMIN_PASSWORD"`
MysqlAdminUsername string `env:"MYSQL_ADMIN_USER"`
MysqlAdminPassword string `env:"MYSQL_ADMIN_PASSWORD"`
DisAdminUsername string `env:"DIS_ADMIN_USER"`
DisAdminPassword string `env:"DIS_ADMIN_PASSWORD"`
}
// SetDefaults sets defaults on the template
@ -66,6 +68,17 @@ func (tpl *Template) SetDefaults() (err error) {
}
}
if tpl.DisAdminUsername == "" {
tpl.DisAdminUsername = "admin"
}
if tpl.DisAdminPassword == "" {
tpl.DisAdminPassword, err = password.Password(64)
if err != nil {
return err
}
}
return nil
}