Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwrap base URL and minor styling #189

Merged
merged 2 commits into from
May 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/bartholomew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ pub fn render(req: Request) -> Result<Response> {
if let Ok(url) = base_url {
config.base_url = Some(url);
}
eprintln!("Base URL: {:?}", &config.base_url);
eprintln!("Prepend route info : {:?}", &config.prepend_route_info);

if let Some(url) = &config.base_url {
eprintln!("Base URL: {}", url);
};
eprintln!("Prepend route info: {:?}", &config.prepend_route_info);

if config.prepend_route_info {
let route_info = match req.headers().get("spin-component-route") {
Expand All @@ -61,7 +64,7 @@ pub fn render(req: Request) -> Result<Response> {
eprintln!("Updated request path: {:?}", path_info);
}

// If a theme is specifed, create theme path
// If a theme is specified, create theme path
let theme_dir = if config.theme.is_some() {
let mut path: PathBuf = PathBuf::from(THEME_PATH);
path.push(config.theme.as_ref().unwrap());
Expand Down Expand Up @@ -92,7 +95,7 @@ pub fn render(req: Request) -> Result<Response> {
// Load the content.
let content_path = content::content_path(PathBuf::from(CONTENT_PATH), &path_info);

eprintln!("Path {}", content_path.to_string_lossy());
eprintln!("Path: {}", content_path.to_string_lossy());

match std::fs::read_to_string(&content_path) {
Ok(full_document) => {
Expand Down
Loading