View Source Horizon.Project (horizon v0.2.5)

Project configuration for web based projects.

  • server_names - List of recognized host names that can be received by nginx.
  • certificate - The certificate to use for the project. Can be nil, :self, or :letsencrypt.
  • authenticator - The authenticator to use for the project. Can be nil or a string, e.g. "webroot".
  • cert_path - Overrides the path to the certificate file.
  • cert_key_path - Overrides the path to the certificate key file.
  • letsencrypt_domain - The domain to use for the letsencrypt certificate.
  • acme_challenge_path - The root path to the acme challenge directory.
  • http_only - If true, only the http clause will be defined.
  • servers - List of servers to proxy to.

## Examples

  #iex> projects = [
    %Horizon.Project{
      name: "my_app1",
      server_names: ["http-demo"],
      http_only: true,
      # certificate: :letsencrypt,
      # letsencrypt_domain: "my_app",
      servers: [
        # Verify PORT is same as in runtime.exs or env.sh.eex
        %Horizon.Server{internal_ip: "127.0.0.1", port: 4000},
        %Horizon.Server{internal_ip: "10.0.0.5", port: 4000}
      ]
    },
    %Horizon.Project{
      name: "my_app2",
      server_names: ["https-demo"],
      certificate: :self,
      servers: [
        # Verify PORT is same as in runtime.exs or env.sh.eex
        %Horizon.Server{internal_ip: "127.0.0.1", port: 5000},
        %Horizon.Server{internal_ip: "10.0.0.5", port: 5000}
      ]
    }
  ]

Summary

Functions

Create a new project configuration.

Types

cert()

@type cert() :: nil | :self | :letsencrypt

t()

@type t() :: %Horizon.Project{
  acme_challenge_path: String.t() | nil,
  authenticator: String.t() | nil,
  cert_key_path: String.t() | nil,
  cert_path: String.t() | nil,
  certificate: cert(),
  http_only: boolean(),
  letsencrypt_domain: String.t() | nil,
  name: String.t(),
  server_names: [String.t()],
  servers: [Horizon.Server.t()]
}

Functions

new(opts \\ [])

@spec new(list()) :: t()

Create a new project configuration.

Examples

iex> Horizon.Project.new(name: "my_project", server_names: ["my-domain.com", "also-mine.io"])
%Horizon.Project{
  name: "my_project",
  server_names: ["my-domain.com", "also-mine.io"],
  certificate: nil,
  acme_challenge_path: nil,
  http_only: false,
  servers: []
}