use placeholder host in docs
This commit is contained in:
@@ -672,7 +672,7 @@ func TestMain(m *testing.M) {
|
||||
|
||||
```hcl
|
||||
provider "artifactapi" {
|
||||
endpoint = "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||
endpoint = "https://artifactapi.example.com"
|
||||
}
|
||||
|
||||
resource "artifactapi_remote" "terraform_registry" {
|
||||
|
||||
@@ -5,9 +5,9 @@ Docker Registry HTTP API V2 for both push and pull, so any client (`docker`,
|
||||
`podman`, `skopeo`, `buildah`) can use it directly.
|
||||
|
||||
```sh
|
||||
docker tag myapp:latest artifactapi.k8s.syd1.au.unkin.net/docker-internal/myapp:latest
|
||||
docker push artifactapi.k8s.syd1.au.unkin.net/docker-internal/myapp:latest
|
||||
docker pull artifactapi.k8s.syd1.au.unkin.net/docker-internal/myapp:latest
|
||||
docker tag myapp:latest artifactapi.example.com/docker-internal/myapp:latest
|
||||
docker push artifactapi.example.com/docker-internal/myapp:latest
|
||||
docker pull artifactapi.example.com/docker-internal/myapp:latest
|
||||
```
|
||||
|
||||
The first path segment after `/v2/` is the artifactapi repo name; the remainder
|
||||
|
||||
+2
-2
@@ -10,6 +10,6 @@ member of a helm virtual to serve it alongside remotes.
|
||||
```bash
|
||||
helm package ./mychart
|
||||
curl -fsSL --upload-file mychart-0.1.0.tgz \
|
||||
https://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/<repo>/files/mychart-0.1.0.tgz
|
||||
helm repo add <repo> https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/<repo>
|
||||
https://artifactapi.example.com/api/v2/remotes/<repo>/files/mychart-0.1.0.tgz
|
||||
helm repo add <repo> https://artifactapi.example.com/api/v1/local/<repo>
|
||||
```
|
||||
|
||||
@@ -8,7 +8,7 @@ release's `metadata.json` at `/api/v1/local/<repo>`. Versions are immutable.
|
||||
```bash
|
||||
puppet module build ./hello
|
||||
curl -fsSL --upload-file pkg/unkin-hello-0.1.0.tar.gz \
|
||||
https://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/<repo>/files/unkin-hello-0.1.0.tar.gz
|
||||
https://artifactapi.example.com/api/v2/remotes/<repo>/files/unkin-hello-0.1.0.tar.gz
|
||||
puppet module install unkin-hello \
|
||||
--module_repository https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/<repo>
|
||||
--module_repository https://artifactapi.example.com/api/v1/local/<repo>
|
||||
```
|
||||
|
||||
@@ -9,7 +9,7 @@ no `.terraformrc` mirror config:
|
||||
terraform {
|
||||
required_providers {
|
||||
artifactapi = {
|
||||
source = "artifactapi.k8s.syd1.au.unkin.net/<repo>/<type>"
|
||||
source = "artifactapi.example.com/<repo>/<type>"
|
||||
version = "0.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,14 @@ import './UsageInstructions.css';
|
||||
import { packageTypes } from '../packagetypes';
|
||||
import type { RepoClass, Snippet } from '../packagetypes/types';
|
||||
|
||||
// baseURL resolves the externally reachable origin of this artifactapi instance.
|
||||
// The UI is served on the same origin as the API (client BASE is ''), so
|
||||
// window.location.origin is the address a host would actually curl/pull against
|
||||
// — no hardcoded hostname, works in prod and in `npm run dev` behind a proxy.
|
||||
// The UI is served on the same origin as the API, so this is the address clients use.
|
||||
function baseURL(): string {
|
||||
if (typeof window !== 'undefined' && window.location?.origin) {
|
||||
return window.location.origin.replace(/\/$/, '');
|
||||
}
|
||||
return 'https://artifactapi.k8s.syd1.au.unkin.net';
|
||||
return window.location.origin;
|
||||
}
|
||||
|
||||
// hostOnly is the bare host[:port] with no scheme, for docker/terraform source
|
||||
// addresses which are scheme-less.
|
||||
// hostOnly is host[:port] for scheme-less docker/terraform addresses.
|
||||
function hostOnly(): string {
|
||||
try {
|
||||
return new URL(baseURL()).host;
|
||||
} catch {
|
||||
return 'artifactapi.k8s.syd1.au.unkin.net';
|
||||
}
|
||||
return window.location.host;
|
||||
}
|
||||
|
||||
// remoteProxyBase is where a remote (or virtual) repo's proxied artifacts live.
|
||||
|
||||
Reference in New Issue
Block a user