Last active
August 12, 2019 14:05
-
-
Save merkuriy/7b511c8f72e5ae22bde062a0a82127e5 to your computer and use it in GitHub Desktop.
badPassport.prototype-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name bad-passport.api.host; | |
charset utf-8; | |
sendfile on; | |
log_not_found off; | |
keepalive_timeout 20; | |
keepalive_requests 50; | |
client_body_timeout 1; | |
send_timeout 1; | |
client_max_body_size 3k; | |
set $rootProjectPath /home/username/project/bad-passport; | |
default_type text/html; | |
location / { | |
return 404 "error404"; | |
} | |
location ~ "^/passports/(\d{4})/(\d{6})$" { | |
set $passportSeries $1; | |
set $passportNumber $2; | |
rewrite ^ /db/$passportSeries/$passportNumber break; | |
root $rootProjectPath; | |
try_files $uri @notFoundBadPassport; | |
} | |
location @notFoundBadPassport { | |
return 404 "badPassportNotFound"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ./db/ | |
file="../list_of_expired_passports/list_of_expired_passports.csv" | |
{ | |
read # skip header line | |
for ((i=10000000;i--;)) ;do # 10M first strings for test prototype | |
IFS=',' read -r passportSeries passportNumber | |
if [[ ! -d "$passportSeries" ]]; then | |
mkdir "$passportSeries" | |
fi | |
ln -nfs "../../html/bad-passport-found.html" "$passportSeries/$passportNumber" | |
done | |
} < "$file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment