The Go Vanity URL Server simplifies creating custom URLs for Go packages.
10K+
The Go Vanity URL Server simplifies creating custom URLs for Go packages, particularly those hosted on GitHub. It acts as a redirection service, facilitating go get operations for your customized package paths.
Go Installation: This project requires Go 1.22 or higher. You can verify your Go version with:
go version
Clone the Repository: Clone the project to your local environment:
git clone https://github.com/Codycody31/go-vanity.git
cd go-vanity
Build the Server: Compile the server from the source code:
go build -o vanity go.codycody31.dev/vanity/cmd/vanity
To run the server:
./vanity
By default, the server utilizes vanity.yaml from the current directory and listens on port 8080. You can access http://localhost:8080/your-package-path to test the redirection.
The server's behavior is controlled through the vanity.yaml file. Here’s an example configuration that specifies the domain and package repositories:
domain: "go.example.com"
packages:
- path: "mylib"
repo: "https://github.com/username/mylib"
vcs: "git"
- path: "myotherlib"
repo: "https://github.com/username/myotherlib"
vcs: "git"
domain: Your custom domain for hosting Go packages.packages: A list of packages with their paths and repository URLs.If would would like to ensure the info your are setting is correct: you can either add # yaml-language-server: $schema=schema/vanity-schema.json to the top of your vanity.yaml file if using VSCode in the project, or you can add # yaml-language-server: $schema=https://raw.githubusercontent.com/Codycody31/go-vanity/main/schema/vanity-schema.json to the top of your vanity.yaml file if using any other editor or if you don't have the schema locally.
Environment Variables:
VANITY_CONFIG: Set this to specify a local path to an alternative configuration file.VANITY_CONFIG_URL: Set this to specify a URL where the configuration file can be fetched, useful for centralized configuration management.You can set environment variables directly or include them in a startup script:
export VANITY_PORT="8080"
export VANITY_CONFIG="/path/to/your/vanity.yaml"
export VANITY_CONFIG_URL="https://example.com/vanity.yaml"
./vanity
Here is an example of how to use the Go Vanity URL Server with the provided configuration:
domain: "go.codycody31.dev"
disableRootPackagesPage: false
poweredBy: true
packages:
- path: "vanity"
repo: "https://github.com/Codycody31/go-vanity"
vcs: "git"
- path: "woodpecker/woodpecker/v2"
repo: "https://github.com/woodpecker/woodpecker"
vcs: "git"
- path: "woodpecker/woodpecker/v3"
repo: "https://github.com/woodpecker/woodpecker"
vcs: "git"
- path: "logger"
repo: "https://github.com/Codycody31/logger"
vcs: "git"
With this configuration, you can access the following packages:
go get go.codycody31.dev/vanitygo get go.codycody31.dev/woodpecker/woodpecker/v2go get go.codycody31.dev/woodpecker/woodpecker/v3go get go.codycody31.dev/loggerAnd the server will redirect the requests to the respective GitHub repositories. We also provide a simple web page to display the list of available packages, this does however result in the root path being redirected to the web page, and not supporting the root path for a package.

docker --version. If not installed, you can download it from the official Docker website.You can pull the pre-built Docker image from the Docker Hub using the following command:
docker pull insidiousfiddler/vanity
Using a Local Configuration File:
To run the server using a local configuration file, you can mount the configuration directory to the Docker container. Make sure your vanity.yaml file is in a suitable directory, then use the following command to start the server:
docker run -p 8080:8080 -v /path/to/your/config/directory:/etc/vanity insidiousfiddler/vanity
This command mounts your local directory containing the vanity.yaml at /etc/vanity inside the container, which is the default path the Docker image expects for the configuration file.
Using a Remote Configuration File:
If you prefer to fetch the configuration from a remote URL, set the VANITY_CONFIG_URL environment variable when running the Docker container:
docker run -p 8080:8080 -e VANITY_CONFIG_URL="https://example.com/vanity.yaml" insidiousfiddler/vanity
This setup is useful for centralized configuration management, allowing you to update the configuration without rebuilding or restarting containers manually.
For more advanced Docker configurations, such as network settings, logging configurations, or using Docker Compose, you can create a docker-compose.yml file or extend the Docker run commands with additional parameters as per your requirements.
We welcome contributions from the community. To contribute:
git checkout -b feature/AmazingFeature).git commit -am 'Add some AmazingFeature').git push origin feature/AmazingFeature).This project is licensed under the MIT License - see the LICENSE file for details.
Content type
Image
Digest
sha256:bb5476096…
Size
3.1 MB
Last updated
over 2 years ago
docker pull insidiousfiddler/vanity