mirror of
https://github.com/pcvolkmer/idicon.git
synced 2025-04-19 16:46:50 +00:00
82 lines
2.6 KiB
Plaintext
82 lines
2.6 KiB
Plaintext
= IdIcon
|
|
|
|
Simple implementation of an identicon service.
|
|
|
|
== Usage
|
|
|
|
=== Start application
|
|
|
|
The application takes two optional arguments to specify the location of the config file and the port the application
|
|
is listening. The following example shows the default values used if no arguments used.
|
|
|
|
....
|
|
$ idicon -c /etc/idicon/config.toml -p 8000
|
|
....
|
|
|
|
=== Client side
|
|
|
|
HTTP `GET` is used to request an identicon image.
|
|
|
|
....
|
|
curl http://localhost:8000/avatar/23463b99b62a72f26ed677cc556c44e8?s=100&c=v2
|
|
....
|
|
|
|
Instead of requesting identicons for MD5 hashes of usernames or mail addresses, it is possible to use plain username and mail address. This will result in the same generated identicon.
|
|
|
|
Use request query parameter `s` to request images with specified size. Default value is 80px. The size is limited to a maximum value of 512px.
|
|
|
|
Query parameter `c` will set color scheme. Available values are `v1`, `v2` and `gh`.
|
|
The latter resembles the color scheme used by GitHub.
|
|
|
|
The request query parameter `d` can be used to request GitHub like patterns by setting the value to `github`.
|
|
|
|
=== Configuration
|
|
|
|
Configuration is available by using a config file or by using environment variables.
|
|
|
|
==== Config file
|
|
|
|
If config file `/etc/identicon/config.toml` exists, its configuration will be used on application start.
|
|
|
|
Use application argument `-c` to use another file.
|
|
....
|
|
$ identicon -c ./config.toml
|
|
....
|
|
|
|
In addition to configuration for default values, the configuration file can also be used to create specific configs for users.
|
|
|
|
....
|
|
[defaults]
|
|
color-scheme = "v2" # Default color scheme
|
|
|
|
[[users]]
|
|
id = "me@example.com" # The users ID in plain text
|
|
alias = "42" # The alias to be used, e.g. for mapping users to other IDs
|
|
color-scheme = "gh" # The color scheme to be used for this user
|
|
pattern = "github" # The pattern to be used for this user
|
|
|
|
[[users]]
|
|
...
|
|
....
|
|
|
|
User specific settings in config file will override any default settings or request params.
|
|
|
|
If config file is not present, the application will ignore it. Using environment variables will override default settings.
|
|
|
|
==== Environment Variables
|
|
|
|
You can use `COLORSCHEME` to define the default color scheme to be used. Fallback value will be `v2`.
|
|
|
|
The `PATTERN` environment variable is available to define GitHub like patterns as default by using `github`.
|
|
|
|
=== Docker build
|
|
|
|
Use `Dockerfile` to build a new image based on `scratch` image and start this image by typing
|
|
|
|
....
|
|
$ docker build -t idicon .
|
|
$ docker run -p 8000:8000 idicon
|
|
....
|
|
|
|
This will build the image and will start a new container listening on port 8000 for requests.
|