Makes kanidmd bail on startup if it can't find the webpkg dir (#531)

* Fixes #528 - DynamicUser was set to kanidmd

* Make kanidmd bail if it cannot find the web ui files
This commit is contained in:
James Hodgkinson 2021-07-22 15:19:01 +10:00 committed by GitHub
parent 8306c3bc6a
commit 8b7f196b2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -140,3 +140,5 @@ Then you are able to build the UI.
./build_wasm.sh
The "developer" profile for kanidmd will automatically use the pkg output in this folder.
Setting different developer profiles while building is done by setting the environment variable KANIDM_BUILD_PROFILE to one of the bare filename of the TOML files in `/profiles`. For example: `KANIDM_BUILD_PROFILE=release_suse_generic cargo build --release --bin kanidmd`

View file

@ -19,6 +19,7 @@ use kanidm_proto::v1::{
};
use serde::Serialize;
use std::path::PathBuf;
use std::str::FromStr;
use uuid::Uuid;
@ -1199,6 +1200,15 @@ pub fn create_https_server(
// If we are no-ui, we remove this.
if !matches!(role, ServerRole::WriteReplicaNoUI) {
let pkg_path = PathBuf::from(env!("KANIDM_WEB_UI_PKG_PATH"));
if !pkg_path.exists() {
eprintln!(
"Couldn't find Web UI package path: ({}), quitting.",
env!("KANIDM_WEB_UI_PKG_PATH")
);
std::process::exit(1);
}
tserver.at("/").get(index_view);
tserver
.at("/pkg")