GcpGcs.Config (GcpGcs v0.2.0)

Copy Markdown View Source

Resolves endpoint, emulator, and Finch settings for GcpGcs.

Production (default)

No configuration is required. Requests go to https://storage.googleapis.com and authenticate via GcpGcs.Auth.

Emulator (development / test)

Point the client at a local emulator such as fake-gcs-server:

config :gcp_gcs, :emulator,
  scheme: "http",
  host: "localhost",
  port: 4443

Alternatively, set the STORAGE_EMULATOR_HOST environment variable (honored by the official Google client libraries), e.g. STORAGE_EMULATOR_HOST=http://localhost:4443.

When an emulator is configured, authentication is skipped.

Finch pool

config :gcp_gcs, :finch,
  pool_size: 50,
  pool_count: 1

Timeouts

config :gcp_gcs, :default_timeout, 30_000

Summary

Functions

Base URL for the JSON API, e.g. https://storage.googleapis.com.

Default request timeout in milliseconds.

Whether an emulator is configured (auth is skipped when true).

The scheme/host/port the Finch pool should connect to.

The registered name of the Finch pool started by GcpGcs.Application.

Base URL for JSON metadata operations, e.g. .../storage/v1.

Base URL for media/resumable uploads, e.g. .../upload/storage/v1.

Types

emulator()

@type emulator() :: %{scheme: String.t(), host: String.t(), port: pos_integer()}

Functions

base_url()

@spec base_url() :: String.t()

Base URL for the JSON API, e.g. https://storage.googleapis.com.

default_timeout()

@spec default_timeout() :: pos_integer()

Default request timeout in milliseconds.

emulator?()

@spec emulator?() :: boolean()

Whether an emulator is configured (auth is skipped when true).

endpoint()

@spec endpoint() :: {:http | :https, String.t(), pos_integer()}

The scheme/host/port the Finch pool should connect to.

Returns {scheme, host, port} where scheme is :http or :https.

finch_name()

@spec finch_name() :: atom()

The registered name of the Finch pool started by GcpGcs.Application.

json_base()

@spec json_base() :: String.t()

Base URL for JSON metadata operations, e.g. .../storage/v1.

upload_base()

@spec upload_base() :: String.t()

Base URL for media/resumable uploads, e.g. .../upload/storage/v1.