Spaceboy.Server (Spaceboy v0.1.1) View Source

Main configuration for your Spaceboy server. Roughly equivalet to Phoenix.Endpoint

TLS certificate and configuration

Server requires TLS certificate to function properly. It can be self-signed and you can generate one with this command:

mix spaceboy.gen.cert

The default location for certificate is: priv/ssl/ but you can change it to whatever path you want via configuration:

config :example, Example.Server,
  host: "localhost",
  port: 1965,
  certfile: "priv/ssl/cert.pem",
  keyfile: "priv/ssl/key.pem"

or when starting your server in Application module (in case you need programatically controlled configuration):

def start(_type, _args) do
  config = [
    host: "localhost",
    port: 1965,
    certfile: "priv/ssl/cert.pem",
    keyfile: "priv/ssl/key.pem"
  ]

  children = [
    {Example.Server, config}
  ]

  Supervisor.start_link(children, strategy: :one_for_one, name: Example.Supervisor)
end

Gemini MIME type

To save yourself from always passing Gemini mime type when sending file it is recommended to add Gemini mime type to MIME library configuration:

config :mime, :types, %{
  "text/gemini" => ["gmi", "gemini"]
}

and you need to recompile MIME library: mix deps.clean mime --build

Link to this section Summary

Functions

Add middleware to your server configuration

Link to this section Functions

Link to this macro

middleware(module, opts \\ [])

View Source (macro)

Add middleware to your server configuration