diff --git a/cmd/bootstrap.go b/cmd/bootstrap.go index b4e8e4f..ae1e7bb 100644 --- a/cmd/bootstrap.go +++ b/cmd/bootstrap.go @@ -99,8 +99,8 @@ func (bs bootstrap) Run(context wisski_distillery.Context) error { if domain == "" { domain = hostname.FQDN() } - overridesPath := filepath.Join(root, "overrides.json") - authorizedKeysFile := filepath.Join(root, "authorized_keys") + overridesPath := filepath.Join(root, core.OverridesJSON) + authorizedKeysFile := filepath.Join(root, core.AuthorizedKeys) { logging.LogMessage(context.IOStream, "Copying over wdcli executable") diff --git a/internal/config/config.go b/internal/config/config.go index 1995a94..487c0bb 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -64,7 +64,7 @@ type Config struct { PasswordLength int `env:"PASSWORD_LENGTH" default:"64" validator:"is_valid_number"` // 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 TriplestoreAdminUser string `env:"GRAPHDB_ADMIN_USER" default:"admin" validator:"is_nonempty"` diff --git a/internal/core/bootstrap.go b/internal/core/bootstrap.go deleted file mode 100644 index a3519d8..0000000 --- a/internal/core/bootstrap.go +++ /dev/null @@ -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 diff --git a/internal/core/core.go b/internal/core/core.go index b58fd66..6570ee9 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -2,6 +2,8 @@ // It does not depend on any other packages. package core +import _ "embed" + // BaseDirectoryDefault is the default deploy directory to load the distillery from. const BaseDirectoryDefault = "/var/www/deploy" @@ -9,6 +11,25 @@ const BaseDirectoryDefault = "/var/www/deploy" // It should be located inside the deployment directory. 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. 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