PageSourceSearch

https://app.metalbear.com/assets/Settings-4DL0eS7Q.js

js metalbear.com collected 2026-09-24 09:24:34 UTC 18,678 bytes, 11 lines download raw bytes

1import{j as e,R as p,d as be,p as Ae,r as v,u as Z,s as ee,a as se,v as B,w as A,x as t,y as K,q as O,z as C,A as te,B as ne,P as re,D as ae,E as oe,t as _,F as Ee,K as ce,b as le,G as ie,H as de,I as Se,J as F,N as o,O as Ce,Q as _e,S as V,e as Te,V as Re,M as Ie,Z as ke}from"./index-yzLLMphG.js";import{P as we}from"./PageHeading-BeMx7C-P.js";import{A as Pe}from"./arrow-right-Ck9ZtviR.js";const De=2e3,xe=[0,3600,86400,604800],me=s=>s.revokedAt===null||new Date(s.revokedAt)>new Date,Le=()=>{const[s,n]=v.useState(!1);return[s,l=>{navigator.clipboard.writeText(l).catch(()=>{}),n(!0),setTimeout(()=>{n(!1)},De)}]},H=({value:s,label:n})=>{const[c,l]=Le();return e.jsx(p,{variant:"ghost",size:"icon","aria-label":n??"Copy",onClick:()=>{l(s)},children:c?e.jsx(be,{className:"h-4 w-4"}):e.jsx(Ae,{className:"h-4 w-4"})})},m=({code:s,label:n})=>e.jsxs("div",{className:"flex items-start gap-1",children:[e.jsx("pre",{className:"flex-1 overflow-x-auto whitespace-pre rounded-md bg-muted/60 px-3 py-2 font-mono text-xs text-foreground",children:s}),e.jsx(H,{value:s,...n!==void 0?{label:n}:{}})]}),Oe="Requires ",Ke="kubectl",Me=" with permissions to create resources, and cluster access to",Ue="analytics.metalbear.com",Ye=" and",$e="app.metalbear.com",He=".",ze="Can't allow that connectivity?",Ge="to get an air-gapped license.",Be="Create the secret in your cluster (the key never sits in your Helm values):",Fe="Then reference it in your",P="values.yaml",Ve="Store the key in GSM (the operator reads 
1it via Application Default Credentials), then reference it in your",qe="Simplest, but the secret lives in your",We="See the full",Qe="on GitHub for all available options.",Xe="Authenticates the operator to the mirrord cloud. Set it as",Je="cloud.apiKey",Ze=" in the operator Helm values.",q="metalbear_key_",es="Created ",ss="Stops ",ts="Share identity-level usage data with mirrord cloud",ns="Gives your usage dashboard per-user detail (usernames, targets). Uncheck to keep telemetry anonymized; the dashboard then shows pseudonymous IDs.",rs="Contact an organization admin to manage API keys.",D=({children:s})=>e.jsx("p",{className:"text-xs font-medium text-foreground",children:s}),W=({checked:s,onChange:n,disabled:c,className:l})=>e.jsxs("label",{className:l,children:[e.jsx(Ee,{className:"mt-0.5",disabled:c,checked:s,onCheckedChange:d=>{n(d===!0)}}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:ts}),e.jsx("br",{}),ns]})]}),as=({value:s,onDismiss:n})=>{const c=`kubectl create secret generic ${t.command.k8sSecretName} \\
2  --namespace mirrord --from-literal=apiKey=${s}`,l=`cloud:
3  apiKey:
4    keyRef: ${t.command.k8sSecretName}`,d=`cloud:
5  apiKey:
6    gsmRef: projects/PROJECT_ID/secrets/SECRET_NAME/versions/latest`,u=`cloud:
7  apiKey:
8    key: ${s}`;return e.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-4 w-4 text-primary"}),e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:t.newKeyTitle}),e.jsx(_,{className:"text-xs px-1.5 py-0 bg-primary/10 text-primary border-primary/20 hover:bg-primary/10",children:t.copyNow})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.onlyShownOnce}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("code",{className:"flex-1 truncate rounded-md bg-muted/60 px-3 py-2 font-mono text-sm text-foreground",children:s}),e.jsx(H,{value:s,label:t.copyKey})]}),e.jsx(K,{}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h5",{className:"text-sm font-semibold text-foreground",children:t.installTitle}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[Oe,e.jsx("code",{className:"font-mono",children:Ke}),Me," ",e.jsx("code",{className:"font-mono",children:Ue}),Ye," ",e.jsx("code",{className:"font-mono",children:$e}),He]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[ze," ",e.jsx("a",{href:t.command.bookDemoUrl,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",children:t.bookDemo})," ",Ge]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{children:t.step.addRepo}),e.jsx(m,{code:t.command.helmRepo,label:t.copyLabel.helmRepo})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(D,{children:t.step.provideKey}),e.jsxs("div",{className:"space-y-1.5 pl-3 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:t.method.k8sSecret}),e.jsx(_,{className:"text-xs px-1.5 py-0",children:t.recommended})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:Be}),e.jsx(m,{code:c,label:t.copyLabel.kubectl}),e.jsxs("p",{className:"text-xs text-muted-foreground pt-1",children:[Fe," ",e.jsx("code",{className:"font-mono",children:P}),":"]}),e.jsx(m,{code:l,label:t.copyLabel.keyRef})]}),e.jsxs("div",{className:"space-y-1.5 pl-3 border-l-2 border-primary/20",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:t.method.gsm}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ve," ",e.jsx("code",{className:"font-mono",children:P}),":"]}),e.jsx(m,{code:d,label:t.copyLabel.gsmRef})]}),e.jsxs("div",{className:"space-y-1.5 pl-3 border-l-2 border-primary/20",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:t.method.inline}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[qe," ",e.jsx("code",{className:"font-mono",children:P}),":"]}
8),e.jsx(m,{code:u,label:t.copyLabel.inline})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{children:t.step.install}),e.jsx(m,{code:t.command.helmInstall,label:t.copyLabel.helmInstall}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[We," ",e.jsx("a",{href:t.command.valuesYamlUrl,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",children:P})," ",Qe]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{children:t.step.verify}),e.jsx(m,{code:t.command.verify,label:t.copyLabel.verify})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{size:"sm",onClick:n,children:t.done})})]})},os=()=>{var k;const{accessToken:s,canManageOrganization:n}=Z(),c=ee(),{data:l,isLoading:d,error:u}=se(le(s)),y=l==null?void 0:l.filter(B),[g,b]=v.useState(null),[M,T]=v.useState(null),E=A(ie(s,c)),h=A(de(s,c)),S=A(Se(s,c)),N=(k=y==null?void 0:y.find(B))==null?void 0:k.identityConsent,j=M??N??!0,f=(y??[]).filter(me),i=f.find(a=>a.revokedAt===null),R=f.filter(a=>a.revokedAt!==null),x=()=>{E.mutate({identityConsent:j},{onSuccess:a=>{b(a.key)}})},U=a=>{h.mutate({graceSeconds:a},{onSuccess:w=>{b(w.key)}})},I=u??E.error??h.error??S.error;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.sectionTitle}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Xe," ",e.jsx("code",{className:"font-mono",children:Je}),Ze]})]}),n&&g!==null&&e.jsx(as,{value:g,onDismiss:()=>{b(null)}}),e.jsx(K,{}),d?e.jsx("div",{className:"flex justify-center py-6",children:e.jsx(O,{fixed:!1})}):i!==void 0?e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/60 bg-muted/20 px-3.5 py-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("code",{className:"font-mono text-sm text-foreground",children:[q,i.first4,e.jsx("span",{className:"text-muted-foreground",children:"…"})]}),e.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[i.createdAt&&e.jsxs("span",{children:[es,C(new Date(i.createdAt))]}),e.jsx("span",{children:i.lastUsedAt?`Last used ${C(new Date(i.lastUsedAt))}`:t.neverUsed})]})]}),n&&e.jsxs(te,{disabled:h.isPending,onValueChange:a=>{U(Number(a))},children:[e.jsx(ne,{className:"w-[150px]",children:e.jsx(re,{placeholder:t.revokePlaceholder})}),e.jsx(ae,{children:xe.map(a=>e.jsx(oe,{value:String(a),children:t.graceLabels[a]},a))})]})]}),n&&e.jsx(W,{checked:i.identityConsent,disabled:S.isPending,onChange:a=>{S.mutate(a)},className:"flex max-w-2xl items-start gap-2 rounded-lg border border-border/60 px-3.5 py-3 text-left"}),R.map(a=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/60 bg-muted/10 px-3.5 py-3",children:[e.jsxs("code",{className:"font-mono text-sm text-muted-foreground",children:[q,a.first4,e.jsx("span",{children:"…"})]}),a.revokedAt&&e.jsxs(_,{variant:"outline",className:"text-xs px-1.5 py-0",children:[ss,C(new Date(a.revokedAt))]})]},a.id))]}):E.isPending?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-xs text-muted-foreground",children:[e.jsx(O,{fixed:!1}),t.generating]}):e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t.noActiveKey}),n?e.jsxs(e.Fragment,{children:[e.jsx(W,{checked:j,onChange:T,className:"flex max-w-md items-start gap-2 text-left"}),e.jsx(p,{size:"sm",onClick:x,children:t.generate})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:rs})]}),I&&e.jsx("p",{className:"text-xs text-destructive",children:I.message.replace(/^\d+:\s*/,"")})]})},Q="metalbear_key_",cs="$USAGE_API_KEY",ls="Created ",is=`${window.location.origin}/api/v2/token`,ds=`${window.location.origin}/api/v1/usage`,xs="/trends?days=30",ms=30,ps=1,us=10,X=s=>s.toISOString().slice(0,us),hs=()=>{const s=new Date;s.setDate(s.getDate()-ms);const n=new Date;return n.setDate(n.getDate()+ps),`from=${X(s)}&to=${X(n)}`},js=s=>`TOKEN=$(curl -sSf -X POST "${is}" \\
9  -H "Content-Type: application/json" \\
10  -d "{\\"apiKey\\":\\"${s}\\"}" | jq -r .token)`,$=s=>`curl -H "Authorization: Bearer $TOKEN" \\
11  "${ds}${s}"`,pe=({apiKey:s})=>{const n=hs(),c=`/report?${n}`,l=`/sessions?${n}&limit=500`;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h5",{className:"text-sm font-semibold text-foreground",children:o.examplesTitle}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o.examplesHint})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:o.endpoints.token}),e.jsx(m,{code:js(s),label:o.copyLabel.token})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:o.endpoints.report}),e.jsx(m,{code:$(c),label:o.copyLabel.report})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:o.endpoints.trends}),e.jsx(m,{code:$(xs),label:o.copyLabel.trends})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:o.endpoints.sessions}),e.jsx(m,{code:$(l),label:o.copyLabel.sessions})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o.identityNote})]})},gs=({value:s,onDismiss:n})=>e.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-4 w-4 text-primary"}),e.jsx("h4",{className:"text-sm font-semibold text-foreground",children:o.newKeyTitle}),e.jsx(_,{className:"text-xs px-1.5 py-0 bg-primary/10 text-primary border-primary/20 hover:bg-primary/10",children:t.copyNow})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.onlyShownOnce}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("code",{className:"flex-1 truncate rounded-md bg-muted/60 px-3 py-2 font-mono text-sm text-foreground",children:s}),e.jsx(H,{value:s,label:o.copyKey})]}),e.jsx(K,{}),e.jsx(pe,{apiKey:s}),e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{size:"sm",onClick:n,children:t.done})})]}),fs=()=>{const{accessToken:s,canManageOrganization:n}=Z(),c=ee(),{data:l,isLoading:d,isFetching:u,error:y}=se(le(s)),[g,b]=v.useState(null),[M,T]=v.useState(""),[E,h]=v.useState(null),[S,N]=v.useState(null),j=A(ie(s,c)),f=A(de(s,c)),i=A(Ce(s,c)),R=(l??[]).filter(F).filter(me),x=R.find(r=>r.revokedAt===null),U=R.filter(r=>r.revokedAt!==null),I=g!==null,k=j.isPending||f.isPending||i.isPending||u,a=I||k,w=r=>{if(r.info===null||!F(r.info)){r.info!==null&&i.mutate(r.info.id),N(o.serverWithoutScopes);return}N(null),b(r.key)},ye=()=>{f.reset(),i.reset(),h(null),N(null),j.mutate({scope:"read_only"},{onSuccess:w})},Ne=r=>{j.reset(),i.reset(),h(null),N(null),T(String(r)),f.mutate({graceSeconds:r,scope:"read_only"},{onSuccess:w,onSettled:()=>{T("")}})},ve=r=>{j.reset(),f.reset(),h(null),N(null),i.mutate(r)},z=r=>E===r?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(p,{size:"sm",variant:"destructive",disabled:a,onClick:()=>{ve(r)},children:o.revokeConfirm}),e.jsx(p,{size:"sm",variant:"ghost",onClick:()=>{h(null)},children:o.revokeCancel})]}):e.jsx(p,{size:"sm",variant:"outline",disabled:a,onClick:()=>{h(r)}
11,children:o.revoke}),Y=y??j.error??f.error??i.error,G=[S,Y==null?void 0:Y.message.replace(/^\d+:\s*/,"")].filter(Boolean).join(" ")||null;return e.jsxs("div",{className:"space-y-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:o.sectionTitle}),n&&g!==null&&e.jsx(gs,{value:g,onDismiss:()=>{b(null)}}),e.jsx(K,{}),d?e.jsx("div",{className:"flex justify-center py-6",children:e.jsx(O,{fixed:!1})}):y?null:e.jsxs("div",{className:"space-y-2.5",children:[x!==void 0&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/60 bg-muted/20 px-3.5 py-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("code",{className:"font-mono text-sm text-foreground",children:[Q,x.first4,e.jsx("span",{className:"text-muted-foreground",children:"…"})]}),e.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[x.createdAt&&e.jsxs("span",{children:[ls,C(new Date(x.createdAt))]}),e.jsx("span",{children:x.lastUsedAt?`Last used ${C(new Date(x.lastUsedAt))}`:t.neverUsed})]})]}),n&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(te,{value:M,disabled:a,onValueChange:r=>{Ne(Number(r))},children:[e.jsx(ne,{className:"w-[190px]",children:e.jsx(re,{placeholder:o.rotatePlaceholder})}),e.jsx(ae,{children:xe.map(r=>e.jsx(oe,{value:String(r),children:o.rotateLabels[r]},r))})]}),z(x.id)]})]}),U.map(r=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/60 bg-muted/10 px-3.5 py-3",children:[e.jsxs("code",{className:"font-mono text-sm text-muted-foreground",children:[Q,r.first4,e.jsx("span",{children:"…"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r.revokedAt&&e.jsxs(_,{variant:"outline",className:"text-xs px-1.5 py-0",children:[o.stops,new Date(r.revokedAt).toLocaleString()]}),n&&z(r.id)]})]},r.id)),x!==void 0&&g===null&&e.jsx(pe,{apiKey:cs}),x===void 0&&g===null&&(j.isPending?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-xs text-muted-foreground",children:[e.jsx(O,{fixed:!1}),o.generating]}):e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:o.noActiveKey}),n?e.jsx(p,{size:"sm",disabled:a,onClick:ye,children:o.generate}):e.jsx("p",{className:"text-xs text-muted-foreground",children:o.adminRequired})]}))]}),G!==null&&e.jsx("p",{className:"text-xs text-destructive",children:G})]})},J="section",ue="Operator",he="Usage API",je="Team",ge="Data and privacy",ys="The key your cluster uses to report sessions to mirrord cloud. Rotate it if it leaks or when you reinstall the operator.",Ns="API key",vs="A read-only key for pulling your usage data into your own analytics tooling. It can read reports, trends and session rows and nothing else, so it cannot stand in for the operator key.",bs="Read-only key",As="Members and roles",Es="What the operator reports",Ss="Everyone who signs in here can see usage; admins can manage the API key and billing. Invite the engineers who deploy to the cluster and the people who own the budget.",Cs="Manage members",_s="The operator reports each session to mirrord cloud so this console can show usage. Whether those reports carry engineer identities (usernames, targets) or pseudonymous ids is your choice, made when you generate the API key.",Ts="What is collected",Rs="https://metalbear.com/mirrord/docs/managing-mirrord/security/",fe=[{id:"operator",label:ue,hint:Ns},{id:"usage-api",label:he,hint:bs},{id:"team",label:je,hint:As},{id:"privacy",label:ge,hint:Es}],Is=s=>fe.some(n=>n.id===s),L=({title:s,description:n,children:c})=>e.jsx(Ie,{children:e.jsxs(ke,{className:"space-y-4 p-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:s}),n&&e.jsx("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:n})]}),c]})}),Ds=()=>{const[s,n]=_e(),c=s.get(J),l=Is(c)?c:"operator";return e.jsxs("div",{className:"space-y-6",children:[e.jsx(we,{title:V.title,description:V.description}),e.jsxs("div",{className:"grid items-start gap-6 lg:grid-cols-[14rem_minmax(0,1fr)]",children:[e.jsx("nav",{"aria-label":"Settings sections",className:"lg:sticky lg:top-20",children:e.jsx("ul",{className:"flex gap-1 overflow-x-auto lg:flex-col lg:gap-1",children:fe.map(d=>{const u=d.id===l;return e.jsx("li",{children:e.jsxs("button",{type:"button","aria-current":u?"page":void 0,onClick:()=>{n({[J]:d.id})},className:`flex w-full flex-col items-start whitespace-nowrap rounded-lg px-3 py-2 text-left transition-colors ${u?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/40 hover:text-foreground"}`,children:[e.jsx("span",{className:"text-sm font-medium",children:d.label}),e.jsx("span",{className:`hidden text-xs lg:block ${u?"text-accent-foreground
11/70":"text-muted-foreground/80"}`,children:d.hint})]})},d.id)})})}),e.jsxs("div",{className:"max-w-3xl",children:[l==="operator"&&e.jsx(L,{title:ue,description:ys,children:e.jsx(os,{})}),l==="usage-api"&&e.jsx(L,{title:he,description:vs,children:e.jsx(fs,{})}),l==="team"&&e.jsx(L,{title:je,description:Ss,children:e.jsxs(p,{size:"sm",className:"gap-1.5",onClick:()=>{Te.AdminPortal.show()},children:[Cs,e.jsx(Pe,{size:14})]})}),l==="privacy"&&e.jsx(L,{title:ge,description:_s,children:e.jsx(p,{size:"sm",variant:"outline",className:"gap-1.5",asChild:!0,children:e.jsxs("a",{href:Rs,target:"_blank",rel:"noreferrer",children:[Ts,e.jsx(Re,{size:14})]})})})]})]})]})};export{Ds as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.