forked from vieter-v/vieter
Split off server into own module
This commit is contained in:
parent
1d434db166
commit
92ad0c51eb
6 changed files with 62 additions and 57 deletions
11
src/server/auth.v
Normal file
11
src/server/auth.v
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module server
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
return x_header.trim_space() == app.conf.api_key
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue