优化配置

This commit is contained in:
NewName
2024-11-15 03:02:14 +08:00
parent 6147b8527f
commit f55e5e4163
5 changed files with 25 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
{$DOMAIN} {
hub.{$DOMAIN} {
root * /srv
file_server
}
@@ -15,8 +15,8 @@ gcr.{$DOMAIN} {
reverse_proxy * gcr:5000
}
k8sgcr.{$DOMAIN} {
reverse_proxy * k8sgcr:5000
quay.{$DOMAIN} {
reverse_proxy * quay:5000
}
registryk8s.{$DOMAIN} {

View File

@@ -91,23 +91,23 @@
<div class="domain-container">
<div class="domain-item">
<div class="domain-text">docker.<span id="domain-base"></span></div>
<div class="domain-text">docker.<span id="domain-docker"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">ghcr.<span id="domain-base"></span></div>
<div class="domain-text">ghcr.<span id="domain-ghcr"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">gcr.<span id="domain-base"></span></div>
<div class="domain-text">gcr.<span id="domain-gcr"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">k8sgcr.<span id="domain-base"></span></div>
<div class="domain-text">quay.<span id="domain-quay"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">registryk8s.<span id="domain-base"></span></div>
<div class="domain-text">registryk8s.<span id="domain-registryk8s"></span></div>
<button class="copy-button">复制</button>
</div>
</div>
@@ -127,11 +127,17 @@
</div>
<script>
const domainBase = new URL(window.location.href).hostname.replace(/^www\./, '');
document.querySelectorAll('#domain-base').forEach(el => {
el.textContent = domainBase;
});
// 从 Docker 环境变量获取根域名
const rootDomain = process.env.DOMAIN || 'example.com';
// 动态设置每个仓库的根域名部分
document.getElementById('domain-docker').textContent = rootDomain;
document.getElementById('domain-ghcr').textContent = rootDomain;
document.getElementById('domain-gcr').textContent = rootDomain;
document.getElementById('domain-quay').textContent = rootDomain;
document.getElementById('domain-registryk8s').textContent = rootDomain;
// 复制按钮功能
document.querySelectorAll('.copy-button').forEach(button => {
button.addEventListener('click', async () => {
const domainText = button.previousElementSibling.textContent;