urlbase

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package urlbase holds the rules for the URLs an app is served under, for the packages that must apply them without depending on each other: config validates GOMBIT_STORAGE_LOCAL_URL and GOMBIT_STORAGE_S3_PUBLIC_URL with the same functions storage/presign and storage/s3 use, so a configuration that validates is one they accept, and it normalises and validates GOMBIT_API_PREFIX with the two APIPrefix functions below, so the prefix a loaded configuration stores is the form its routes, its OpenAPI document and the client generated from that document are all built from.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIPrefixProblem added in v0.9.0

func APIPrefixProblem(prefix string) string

APIPrefixProblem reports why prefix cannot be served as an API prefix, or "" when it can. A prefix that has a canonical form but is not already it is still a problem: the callers that read config.API.Prefix get the field, not this function, so only a canonical value reaches all of them unchanged.

func Base

func Base(base string) (path, problem string)

Base checks where a store's URLs are served (presign.Config.Base): a path ("/_storage") or an http(s) URL with one ("https://files.example.com/_storage"), without a query, fragment, credentials, or trailing '/', whose path is plain (no percent-escapes: the path is matched against requests as decoded, so it must be the same written either way). It returns the path, or why base is not one.

func CanonicalAPIPrefix added in v0.9.0

func CanonicalAPIPrefix(prefix string) string

CanonicalAPIPrefix returns the canonical form of an API prefix, or "" when it has none, which APIPrefixProblem explains.

func Root

func Root(root string) string

Root checks the URL a bucket's public objects are read from (s3.Config.PublicURL): an http(s) URL, with or without a path, without a query, fragment, credentials, or trailing '/'. It returns why root is not one, or "".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL