-
Notifications
You must be signed in to change notification settings - Fork 2
/
airportsd.8
142 lines (141 loc) · 3.22 KB
/
airportsd.8
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.\" Automatically generated by Pandoc 3.0.1
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "AIRPORTSD" "8" "" "User Manuals" ""
.hy
.SH NAME
.PP
airportsd - IATA airport code lookup server
.SH SYNOPSIS
.PP
airportsd [-v]
.SH DESCRIPTION
.PP
\f[I]airportsd\f[R] is an HTTP-accessible IATA airport code lookup
daemon.
We created this as a service students can use on lab machines for
developing an Ansible lookup plugin during trainings.
.PP
When running on a \f[I]tty\f[R] the program will output brief debugging
information on startup, and when it\[cq]s queried.
.PP
The (currently hard-coded) \f[I]CDB\f[R] database must exist and be
readable by the owner of the \f[I]airportsd\f[R] process.
.SH EXAMPLE
.IP
.nf
\f[C]
$ curl -i http://127.0.0.1:8812/lookup?iata=bcn
HTTP/1.1 200 OK
Date: Wed, 26 Mar 2024 22:17:20 GMT
Connection: close
Content-Type: application/json
Content-Length: 216
{
\[dq]id\[dq]: \[dq]4004\[dq],
\[dq]iata\[dq]: \[dq]BCN\[dq],
\[dq]cc\[dq]: \[dq]ES\[dq],
\[dq]city\[dq]: \[dq]Barcelona\[dq],
\[dq]lat\[dq]: \[dq]41.2971\[dq],
\[dq]lon\[dq]: \[dq]2.07846\[dq],
\[dq]name\[dq]: \[dq]Josep Tarradellas Barcelona-El Prat Airport\[dq],
\[dq]type\[dq]: \[dq]large_airport\[dq],
\[dq]emoji\[dq]: \[dq]🇪🇸\[dq]
}
\f[R]
.fi
.SH ENDPOINTS
.PP
All \f[I]airportsd\f[R] API endpoints are obtained via GET requests.
.SS \f[V]lookup\f[R]
.PP
This endpoint expects \f[V]iata\f[R] query parameter with a case
insensitive 3-letter IATA airport code; the key is looked up in the
database and the JSON data or HTTP status code 404 are returned.
.SH OPTIONS
.PP
\f[I]airportsd\f[R] understands the following global options.
.TP
-v
show version information and exit
.SH ENVIRONMENT
.TP
\f[V]AIRPORTSD_IP\f[R]
optionally sets the listen address for \f[I]airportsd\f[R]; defaults to
\f[V]127.0.0.1\f[R] and we strongly recommend this is not changed to
anything other than a loopback address.
.TP
\f[V]AIRPORTSD_PORT\f[R]
optionally sets the TCP listen port to something other than the default
\f[V]8812\f[R].
.SH FILES
.TP
\f[V]/usr/local/share/airports.cdb\f[R]
the database file to query.
.SH REQUIREMENTS
.SS freebsd
.IP
.nf
\f[C]
$ pkg install libmicrohttpd tinycdb
$ cat > config.mk <<EOF
DBNAME= \[dq]/usr/local/share/airports.cdb\[dq]
LISTEN_HOST= \[dq]127.0.0.1\[dq]
LISTEN_PORT= \[dq]8812\[dq]
INC = -I/usr/local/include
LIBS = -L /usr/local/lib
EOF
\f[R]
.fi
.SS rhel/centos
.IP
.nf
\f[C]
yum install tinycdb
\f[R]
.fi
.SS debian
.IP
.nf
\f[C]
apt-get install tinycdb
\f[R]
.fi
.SS macos
.IP
.nf
\f[C]
brew install libmicrohttpd tinycdb
\f[R]
.fi
.SS all
.IP \[bu] 2
libmicrohttpd (https://www.gnu.org/software/libmicrohttpd/)
.IP \[bu] 2
tinycdb (http://www.corpit.ru/mjt/tinycdb.html)
.SH CREDITS
.IP \[bu] 2
Airport data gratefully put into the Public Domain by
ourairports.com (https://ourairports.com/data/).
.IP \[bu] 2
Country emoji flags from Emoji
Flags (https://github.com/jonathan-kosgei/emoji-flags)
.SH AVAILABILITY
.PP
<https://github.com/jpmens/airportsd>
.SH AUTHOR
.PP
Jan-Piet Mens <https://jpmens.net>