Minor refactor in 'core' package

This commit is contained in:
Tom Wiesing 2022-09-13 09:52:37 +02:00
parent a360324f62
commit 94263174cf
No known key found for this signature in database
4 changed files with 25 additions and 19 deletions

View file

@ -99,8 +99,8 @@ func (bs bootstrap) Run(context wisski_distillery.Context) error {
if domain == "" { if domain == "" {
domain = hostname.FQDN() domain = hostname.FQDN()
} }
overridesPath := filepath.Join(root, "overrides.json") overridesPath := filepath.Join(root, core.OverridesJSON)
authorizedKeysFile := filepath.Join(root, "authorized_keys") authorizedKeysFile := filepath.Join(root, core.AuthorizedKeys)
{ {
logging.LogMessage(context.IOStream, "Copying over wdcli executable") logging.LogMessage(context.IOStream, "Copying over wdcli executable")

View file

@ -64,7 +64,7 @@ type Config struct {
PasswordLength int `env:"PASSWORD_LENGTH" default:"64" validator:"is_valid_number"` PasswordLength int `env:"PASSWORD_LENGTH" default:"64" validator:"is_valid_number"`
// A file to be used for global authorized_keys for the ssh server. // A file to be used for global authorized_keys for the ssh server.
GlobalAuthorizedKeysFile string `env:"GLOBAL_AUTHORIZED_KEYS_FILE" default:"/distillery/authorized_keys" validator:"is_valid_file"` GlobalAuthorizedKeysFile string `env:"GLOBAL_AUTHORIZED_KEYS_FILE" default:"/var/www/deploy/authorized_keys" validator:"is_valid_file"`
// admin credentials for graphdb // admin credentials for graphdb
TriplestoreAdminUser string `env:"GRAPHDB_ADMIN_USER" default:"admin" validator:"is_nonempty"` TriplestoreAdminUser string `env:"GRAPHDB_ADMIN_USER" default:"admin" validator:"is_nonempty"`

View file

@ -1,15 +0,0 @@
package core
import _ "embed"
// DefaultOverridesJSON contains a template for a new 'overrides.json' file
//go:embed bootstrap/overrides.json
var DefaultOverridesJSON []byte
// DefaultAuthorizedKeys contains a template for a new 'global_authorized_keys' file
//go:embed bootstrap/global_authorized_keys
var DefaultAuthorizedKeys []byte
// ConfigFileTemplate contains a template for a new configuration file
//go:embed bootstrap/env
var ConfigFileTemplate []byte

View file

@ -2,6 +2,8 @@
// It does not depend on any other packages. // It does not depend on any other packages.
package core package core
import _ "embed"
// BaseDirectoryDefault is the default deploy directory to load the distillery from. // BaseDirectoryDefault is the default deploy directory to load the distillery from.
const BaseDirectoryDefault = "/var/www/deploy" const BaseDirectoryDefault = "/var/www/deploy"
@ -9,6 +11,25 @@ const BaseDirectoryDefault = "/var/www/deploy"
// It should be located inside the deployment directory. // It should be located inside the deployment directory.
const Executable = "wdcli" const Executable = "wdcli"
// Config file is the name of the config file. // ConfigFile is the name of the config file.
// It should be located inside the deployment directory. // It should be located inside the deployment directory.
const ConfigFile = ".env" const ConfigFile = ".env"
// ConfigFileTemplate contains a template for a new configuration file
//go:embed bootstrap/env
var ConfigFileTemplate []byte
// OverridesJSON is the name of the json overrides file.
// It should be located inside the deployment directory.
const OverridesJSON = "overrides.json"
// DefaultOverridesJSON contains a template for a new 'overrides.json' file
//go:embed bootstrap/overrides.json
var DefaultOverridesJSON []byte
// AuthorizedKeys contains the default name for the 'global_authorized_keys' file
const AuthorizedKeys = "authorized_keys"
// DefaultAuthorizedKeys contains a template for a new 'global_authorized_keys' file
//go:embed bootstrap/global_authorized_keys
var DefaultAuthorizedKeys []byte