aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 32495eb2b838a6b641696032e2e34368f2c7855a (plain)
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
# README for fifconfig
## Metadata
Filename: README.md
Location: https://gitlab.com/bgstack15/fifconfig
Author: bgstack15
Startdate: 2022-03-15
Title: Flask-ifconfig, or Http client diagnostic webapp
Purpose: Replicate http://ifconfig.me
History:
Usage:
Reference: See References heading
Improve:
Dependencies: See Dependencies heading
Documentation:

## Upstream
[gitlab](https://gitlab.com/bgstack15/fifconfig)
[author's git](https://bgstack15.ddns.net/cgit/fifconfig)

## Features

* Provide different output type based on `Accept` header or url parameter. Options include:
  * `application/json` or `?json`
  * `text/html` or `?html`
  * `application/xml` or `?xml`
  * `text/plain` or `?text`
* Display IP address as viewed by the web server, or else the first entry of `HTTP_X_FORWARDED_FOR`.

## Using fifconfig
Visit the application.

    curl -L https://bgstack15.ddns.net/ifconfig/?json | jq

### Installing

You can use flask for development, and uwsgi for production.

### Instructions

Configure the application with these two files, based on the `.example` files available in the source code:

* fifconfig.conf
* fifconfig.wsgi.ini

#### Development
Run server in development mode.

    FLASK_APP=fifconfig.py FLASK_DEBUG=True flask run --host='0.0.0.0'

#### Production
Run the server in a full wsgi environment for the cleanup timer to operate.

    ./fifconfig.bin

The html responses include links to the various single-field pages, unless you add a parameter `?nolinks`. These links depend on any reverse-proxy servers adding themselves correctly to header `X-Forwarded-For`.

## Alternatives
This project was a ripoff of love of [http://ifconfig.me](http://ifconfig.me).

## References

1. [flask.Request — Flask API](https://tedboy.github.io/flask/generated/generated/flask.Request.html)
2. [my stackbin.py project](https://bgstack15.ddns.net/cgit/stackbin/tree/stackbin.py)
3. [dicttoxml - PyPI](https://pypi.org/project/dicttoxml)
bgstack15