Update README, make Swagger UI page accessible
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Armin Friedl 2020-07-29 18:18:15 +02:00
parent 5c6bd1b1ad
commit 3b047f4b56
Signed by: armin
GPG key ID: 48C726EEE7FBCBC8
2 changed files with 49 additions and 37 deletions

View file

@ -1,59 +1,54 @@
[![Build Status](https://drone.friedl.net/api/badges/incubator/fling/status.svg)](https://drone.friedl.net/incubator/fling) [![Build Status](https://drone.friedl.net/api/badges/incubator/fling/status.svg)](https://drone.friedl.net/incubator/fling)
# Fling # Fling
Have you ever missed the simplicity of an USB Stick when sharing data over the
net?
Zero-friction sharing is a surprisingly unsolved problem. There's no reasonably
ubiquitous solution installed on everybody's machine. Online providers are often
packed with features, but miss out on things like direct download urls, a space
for others to easily _upload_ to you, or require registration from all
participants. I don't remember any of these things being a problem with USB 🤔.
Fling is a self-hosted file share. It is simple like USB without missing out on Fling is a self-hosted file share. It is simple like USB without missing out on
the good parts of the web: the good parts of a web app:
- Drop files on a fling and share the URL. That's it. The fling way of life. - Just drop files on a Fling and share the URL
- Choose your own name for your share-URL
Other features include:
- Choose your own, meaningful name for your sharing URL
- Share a direct download link - Share a direct download link
- Choose to let others upload files just as simple - Let others upload files
- Protect your fling by a password - no registration required - Protect your fling by a password - no registration required
- Let a fling expire after a date or a number of clicks (or keep it forever) - Let a fling expire after a date or a number of clicks
# Fling is a API # API
It gets even better! Fling is distributed as both, a backend service and a web interface. You can use
the backend on its own with any [HTTP client](examples).
Fling is a backend service and a web interface. But you can use anything else Per default Fling publishes a Swagger UI page and an OpenAPI spec. You can find
that speaks HTTP if you prefer. In fact, we generate and publish a javascript them here:
and python client for the Fling API on every build. If you like it bare-bones
there is also a querysheet in the examples folder with raw HTTP calls.
Fling also has a code-first OpenAPI compliant spec. O mon Dieu, it just checks ``` http
_all_ the boxes! http://<host>:<port>/swagger-ui.html
http://<host>:<port>/v3/api-docs
```
# Fling as a container If starting the fling container locally, the default `<host>:<port>` is
It gets even even better better! http://localhost:3000. You can also find a recent version of it via
https://fling.friedl.net/swagger-ui.html and
https://fling.friedl.net/v3/api-docs.
Fling is self-hosted. But it is packaged up in a container for easy deployment. # Starting Fling from Docker
Run `docker run --rm -p3000:3000 arminfriedl/fling` and go to A Fling container is provided at https://hub.docker.com/repository/docker/arminfriedl/fling.
http://localhost:3000. The default admin user is `adminName:adminPassword`.
1. Run `docker run --rm -p3000:3000 arminfriedl/fling`
2. Go to the default http://localhost:3000
3. Log in with `adminName:adminPassword`.
## Configuring Fling ## Configuring Fling
The Fling container can be configured by environment variables. The Fling container can be configured by environment variables.
Web interface configuration (`config.js`/`config.js.template`; will be replaced The web interface configuration ([config.js](web/fling/public/config.js)/[config.js.template](container/var/www/fling/config.js.template)) will be
by `envsubst` when the container starts up): filled by `envsubst` when the container starts up.
``` sh ``` sh
# The base URL of the Fling API service # The base URL of the Fling API service
FLING_API_BASE=http://localhost:3000 FLING_API_BASE=http://localhost:3000
# Log level of the application
FLING_LOG_LEVEL=warn FLING_LOG_LEVEL=warn
# Max. upload size in bytes # Max. upload size in bytes. Checked on client side.
FLING_FILESIZE=209715200 FLING_FILESIZE=209715200
``` ```
Fling service configuration (`application-prod.yml`). Standard spring The Fling service configuration is a standard spring configuration. It can be
configuration, can be set by environement variables or any other set by environement variables or any other [configuration externalization supported by spring boot]
[externalization facilities of spring boot](https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config)). (https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config)).
Please refer to `application-prod.yml` for configuration possibilites. Refer to the [application-prod.yml](service/fling/src/main/resources/application-prod.yml) for configuration options.

View file

@ -61,6 +61,23 @@ server {
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
} }
# handle openapi requests by openapi servlet
location /swagger-ui {
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
# Required for web sockets to function
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# always respond with index.html for unknown paths # always respond with index.html for unknown paths
# (routing is client side) # (routing is client side)
location / { location / {