forked from cadence/breezewiki
		
	Look for paths relative to source files
This commit is contained in:
		
							parent
							
								
									8c65b2ed02
								
							
						
					
					
						commit
						73a5cb68c5
					
				
					 2 changed files with 8 additions and 2 deletions
				
			
		|  | @ -1,5 +1,6 @@ | ||||||
| #lang racket/base | #lang racket/base | ||||||
| (require racket/path | (require racket/path | ||||||
|  |          racket/runtime-path | ||||||
|          net/url |          net/url | ||||||
|          web-server/servlet-dispatch |          web-server/servlet-dispatch | ||||||
|          web-server/dispatchers/filesystem-map |          web-server/dispatchers/filesystem-map | ||||||
|  | @ -15,6 +16,8 @@ | ||||||
|          "src/page-wiki.rkt" |          "src/page-wiki.rkt" | ||||||
|          "src/page-search.rkt") |          "src/page-search.rkt") | ||||||
| 
 | 
 | ||||||
|  | (define-runtime-path path-static "static") | ||||||
|  | 
 | ||||||
| (define mime-types | (define mime-types | ||||||
|   (hash #".css" #"text/css" |   (hash #".css" #"text/css" | ||||||
|         #".svg" #"image/svg+xml")) |         #".svg" #"image/svg+xml")) | ||||||
|  | @ -30,7 +33,7 @@ | ||||||
|     (filter:make #rx"^/static/" (files:make |     (filter:make #rx"^/static/" (files:make | ||||||
|                                  #:url->path |                                  #:url->path | ||||||
|                                  (lambda (u) |                                  (lambda (u) | ||||||
|                                    ((make-url->path "static") |                                    ((make-url->path path-static) | ||||||
|                                     (struct-copy url u [path (cdr (url-path u))]))) |                                     (struct-copy url u [path (cdr (url-path u))]))) | ||||||
|                                  #:path->mime-type |                                  #:path->mime-type | ||||||
|                                  (lambda (u) |                                  (lambda (u) | ||||||
|  |  | ||||||
|  | @ -1,8 +1,11 @@ | ||||||
| #lang racket/base | #lang racket/base | ||||||
|  | (require racket/runtime-path) | ||||||
| 
 | 
 | ||||||
| (provide | (provide | ||||||
|  config-get) |  config-get) | ||||||
| 
 | 
 | ||||||
|  | (define-runtime-path path-config "../config.txt") | ||||||
|  | 
 | ||||||
| (define (config-get key) | (define (config-get key) | ||||||
|   (hash-ref config key)) |   (hash-ref config key)) | ||||||
| 
 | 
 | ||||||
|  | @ -18,7 +21,7 @@ | ||||||
|     default-config |     default-config | ||||||
|     (with-handlers ([exn:fail:filesystem:errno? (λ (exn) |     (with-handlers ([exn:fail:filesystem:errno? (λ (exn) | ||||||
|                                                   '())]) |                                                   '())]) | ||||||
|       (call-with-input-file "../config.txt" |       (call-with-input-file path-config | ||||||
|         (λ (in) |         (λ (in) | ||||||
|           (let loop ([alist '()]) |           (let loop ([alist '()]) | ||||||
|             (let ([key (read in)] |             (let ([key (read in)] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue