vieter/src/server/auth.v

12 lines
239 B
Coq
Raw Normal View History

2022-02-21 20:51:41 +01:00
module server
2022-01-11 21:18:33 +01:00
import net.http
fn (mut app App) is_authorized() bool {
x_header := app.req.header.get_custom('X-Api-Key', http.HeaderQueryConfig{ exact: true }) or {
return false
}
2022-02-21 20:40:13 +01:00
return x_header.trim_space() == app.conf.api_key
2022-01-11 21:18:33 +01:00
}