@lunora/cli
Version:
The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands
2 lines (1 loc) • 743 B
JavaScript
import{readFileSync as s}from"node:fs";import{join as a}from"node:path";import{DEV_VARS_FILE as u,parseDevVariableEntries as c}from"@lunora/config";const n="LUNORA_ADMIN_TOKEN",v=new Set(["127.0.0.1","::1","[::1]","localhost"]),f=r=>{if(r===void 0||r==="")return!0;try{return v.has(new URL(r).hostname)}catch{return!1}},l=r=>{let e;try{e=s(a(r,u),"utf8")}catch{return}const o=c(e).find(t=>t.key===n);return o?.value===""?void 0:o?.value},p=({cwd:r,token:e,url:o})=>{if(e!==void 0&&e!=="")return{source:"flag",token:e};const t=process.env[n];if(t!==void 0&&t!=="")return{source:"env",token:t};if(!f(o))return{};const i=l(r);return i===void 0?{}:{source:"dev-vars",token:i}},h=r=>r==="flag"?"--token":r==="env"?n:u;export{f as d,p as l,h as v};