Manage .env from the admin panel
Add an Environment tab to /admin that lists every variable in .env.example and lets keys, OAuth settings, email settings and generated secrets be changed without SSH. Secrets are write-only; infrastructure variables are shown read-only. The backend never writes .env or touches Docker. It validates an edit and queues it in env-apply/run/request.json; env-apply/apply.py, run on the host by a systemd path unit (env-apply/install.sh), rewrites .env atomically, keeps .env.bak, and recreates only the services that read the change. backend/services/env_registry.json is the single list of variables, shared by the backend and the host script; a test keeps it in step with .env.example. It replaces the drifted checklist in handle_admin.go. The job capture token card moves to the new tab. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<!--
|
||||
A credential shown exactly once: the value, a copy button, and the warning
|
||||
that it cannot be read back. Used wherever the server mints a secret and
|
||||
keeps only a hash of it, or no copy the browser can ask for again.
|
||||
-->
|
||||
<script setup>
|
||||
import { ref, watch } from "vue";
|
||||
import Button from "@/components/input/Button.vue";
|
||||
|
||||
const props = defineProps({
|
||||
value: { type: String, required: true },
|
||||
label: { type: String, default: "" },
|
||||
});
|
||||
|
||||
const copied = ref(false);
|
||||
const failed = ref(false);
|
||||
|
||||
// A regenerated value is a new thing to copy.
|
||||
watch(
|
||||
() => props.value,
|
||||
() => {
|
||||
copied.value = false;
|
||||
failed.value = false;
|
||||
},
|
||||
);
|
||||
|
||||
async function copy() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(props.value);
|
||||
copied.value = true;
|
||||
} catch {
|
||||
// Clipboard access can be refused; the value is on screen to select.
|
||||
failed.value = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="secret-reveal">
|
||||
<p class="secret-note">
|
||||
<code v-if="label">{{ label }}</code>
|
||||
Copy this now. It will not be shown again.
|
||||
</p>
|
||||
<code class="secret-value">{{ value }}</code>
|
||||
<Button class="px-2" @click="copy">{{ copied ? "Copied" : "Copy" }}</Button>
|
||||
<p v-if="failed" class="secret-note secret-failed">
|
||||
Could not copy — select the value and copy it by hand.
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.secret-reveal {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px;
|
||||
border: 1px solid var(--color-tertiary);
|
||||
background: var(--color-surface-tint);
|
||||
}
|
||||
.secret-note {
|
||||
flex-basis: 100%;
|
||||
margin: 0;
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.secret-failed {
|
||||
color: var(--color-error, #b91c1c);
|
||||
}
|
||||
.secret-value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 0.8rem;
|
||||
word-break: break-all;
|
||||
user-select: all;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user