-
Notifications
You must be signed in to change notification settings - Fork 11
/
gramex.yaml
121 lines (113 loc) · 3.14 KB
/
gramex.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
variables:
GUIDE_ROOT: $YAMLURL # Used by guide.py to pass to markdown.template
# Created by [email protected]
# https://console.developers.google.com/apis/api/customsearch.googleapis.com/overview?project=big-query-1009
# This key is also used by https://code.gramener.com/s.anand/exceltranslate
# Used by proxyhandler/ and translate/
GOOGLE_API_KEY: AIzaSyBsSkZb3hxciFp0ZB3KLqO1-aQW-K-hqSw
log:
loggers:
gramex:
level: WARNING
matplotlib:
level: INFO
botocore:
level: INFO
MARKDOWN:
level: INFO
passlib:
level: INFO
PIL:
level: INFO
app:
settings:
login_url: /$YAMLURL/auth/db # Use DB Auth by default -- it works offline
autoreload: False
debug: False
xsrf_cookie_kwargs:
httponly: false # Allow JavaScript access to cookies
import:
subdirs:
path: "*/gramex.yaml" # Import gramex.yaml from immediate subdirs
namespace: [url, schedule, cache, import]
ui:
path: $GRAMEXAPPS/ui/gramex.yaml # Import UI app
YAMLURL: $YAMLURL/ui/
handlers:
FileHandler:
ignore:
- ".*" # Hide only dotfiles, allow gramex.yaml
url:
# Default FileHandler. Serve all .md files as Markdown
guide-markdown:
pattern: /$YAMLURL/(.*)
handler: FileHandler
priority: -0.5 # Lower than new handlers (0), higher than default (-1)
kwargs:
path: $YAMLPATH
default_filename: README.md
index: true
transform: &MARKDOWN_TO_HTML
"*.md":
function: guide.markdown_template(content, handler)
encoding: utf-8
headers:
Content-Type: text/html
headers: &HEADERS
Cache-Control: public, max-age=300
Access-Control-Allow-Origin: "*" # Allow CORS from any domain
guide-home:
pattern: /$YAMLURL/home
handler: FileHandler
kwargs:
path: $YAMLPATH/home.md
transform: *MARKDOWN_TO_HTML
guide-api:
pattern: /$YAMLURL/api/(.*)
handler: FileHandler
kwargs:
path: $YAMLPATH/api/
default_filename: index.html
guide-markdown-g1:
pattern: /$YAMLURL/g1/([a-z0-9]+)
handler: FileHandler
kwargs:
path: $YAMLPATH/g1/*.md
transform: *MARKDOWN_TO_HTML
headers: *HEADERS
# The final *computed* gramex.yaml configuration
guide-final-config:
pattern: /$YAMLURL/final-config
handler: FunctionHandler
kwargs:
function: guide.config
headers: *HEADERS
# Just serve the root gramex.yaml file
guide-root-config:
pattern: /$YAMLURL/root.gramex.yaml
handler: FileHandler
kwargs:
path: $GRAMEXPATH/gramex.yaml
headers:
Content-Type: text/plain
<<: *HEADERS
# Static files are cached on the browser
guide-static:
pattern: /$YAMLURL/(.*\.s?css|.*\.js|.*\.vue|.*\.ts)
handler: FileHandler
kwargs:
path: $YAMLPATH/*
sass: "*.scss"
vue: "*.vue"
ts: "*.ts"
headers:
Cache-Control: public, max-age=300
# /path.source shows the raw file as plain text
guide-source:
pattern: /$YAMLURL/(.*)\.source
handler: FileHandler
kwargs:
path: $YAMLPATH
headers:
Content-Type: text/plain
headers: *HEADERS