Environment & secretsמשתני סביבה וסודות
Values go in and never come back out. That is the entire design, and every awkward edge in this page follows from it.
ערכים נכנסים ולעולם לא יוצאים. זה כל העיצוב, וכל פינה לא נוחה בעמוד הזה נובעת ממנו.
Setting a valueהגדרת ערך
# preferred: nothing lands in shell history shipyard env set STRIPE_SECRET_KEY --from-stdin # generated: 32 random bytes, base64url, never displayed shipyard env set SESSION_SECRET --generate # from a file, for bulk import shipyard env push .env.production
env push reads a standard dotenv file, sets everything in it, and reports what changed. It does not delete names that are absent from the file; use env unset for that, deliberately.
env push קורא קובץ dotenv סטנדרטי, מגדיר את כל מה שבו, ומדווח מה השתנה. הוא לא מוחק שמות שחסרים בקובץ; לשם כך משתמשים ב-env unset, במודע.
Reading a valueקריאת ערך
You cannot. There is no CLI flag, no API route, no panel button and no agent tool that returns a stored value. env list gives you the shape of your configuration and nothing else:
אי אפשר. אין דגל CLI, אין נתיב API, אין כפתור בפאנל ואין כלי סוכן שמחזיר ערך שמור. env list נותן לכם את צורת ההגדרות ותו לא:
$ shipyard env list NAME SET BY UPDATED SECRET DATABASE_URL (service) 6d ago yes REDIS_URL (service) 6d ago yes STRIPE_SECRET_KEY dmitry 2d ago yes SESSION_SECRET (generated) 14d ago yes LOG_LEVEL ariel 2d ago no
If you lose a value, you rotate it at the source and set the new one. That is genuinely more annoying than reading it back. It is also the reason a stolen API key, a compromised laptop or a curious contractor cannot walk out with your Stripe credentials.
אם איבדתם ערך, מסובבים אותו במקור ומגדירים חדש. זה באמת יותר מעצבן מלקרוא אותו חזרה. זו גם הסיבה שמפתח API גנוב, מחשב שנפרץ או קבלן סקרן לא יכולים לצאת עם אישורי ה-Stripe שלכם.
How values reach your processאיך הערכים מגיעים לתהליך שלכם
- 1At deploy time the platform decrypts the set for the target environment.בזמן הפריסה הפלטפורמה מפענחת את הסט של סביבת היעד.
- 2They are injected into the container as real environment variables. Your code reads
process.env.DATABASE_URLexactly as it does locally.הם מוזרקים לקונטיינר כמשתני סביבה אמיתיים. הקוד שלכם קוראprocess.env.DATABASE_URLבדיוק כמו בסביבה מקומית. - 3They are not available during the build. A build that needs a secret is a build that bakes a secret into an image, which is a thing we will not help you do.הם לא זמינים בזמן הבנייה. בנייה שזקוקה לסוד היא בנייה שצורבת סוד לתוך התמונה, וזה דבר שלא נעזור לכם לעשות.
The exception is build-time public configuration, which by definition is not secret. Prefix it NEXT_PUBLIC_, VITE_ or mark it build: true and it is available to the builder, visible in your bundle, and listed as non-secret in env list.
החריג הוא הגדרות ציבוריות לזמן בנייה, שמעצם הגדרתן אינן סודיות. הוסיפו קידומת NEXT_PUBLIC_, VITE_ או סמנו build: true והן יהיו זמינות לבנאי, גלויות ב-bundle, ומסומנות כלא-סודיות ב-env list.
Managed service credentialsאישורים של שירותים מנוהלים
Declaring postgres17 or redis in shipyard.yaml creates the instance and injects its connection string. Those variables show (service) as the setter and cannot be overwritten by hand; the platform owns them because the platform rotates them.
הצהרה על postgres17 או redis ב-shipyard.yaml יוצרת את המופע ומזריקה את מחרוזת החיבור. המשתנים האלה מציגים (service) כמגדיר ואי אפשר לדרוס אותם ידנית; הפלטפורמה מחזיקה בהם כי הפלטפורמה מסובבת אותם.
DATABASE_URLPostgres, from services: postgres17.Postgres, מתוך services: postgres17.REDIS_URLRedis, from services: redis.Redis, מתוך services: redis.SHIPYARD_REGIONWhere this process is running. Useful for logging and for region-aware code.היכן התהליך הזה רץ. שימושי ללוגים ולקוד שמודע לאזור.SHIPYARD_DEPLOYMENTThe dep_… id of the running release. Put it in your error reports.מזהה ה-dep_… של השחרור הרץ. שימו אותו בדוחות השגיאות שלכם.Rotatingסיבוב
- Set the new value, then deploy. The running release keeps the old value until it is replaced, so there is no window where the process has half a configuration.מגדירים את הערך החדש ואז פורסים. השחרור הרץ שומר על הערך הישן עד שהוא מוחלף, ולכן אין חלון שבו לתהליך יש חצי הגדרה.
- For a credential that has to overlap, add a second variable, deploy, migrate, then remove the first. Two deploys, no downtime.לאישור שדורש חפיפה, הוסיפו משתנה שני, פרסו, העבירו, ואז הסירו את הראשון. שתי פריסות, בלי זמן השבתה.
- Every set, unset and rotation is in the audit log with the actor and the timestamp. The value is not.כל הגדרה, הסרה וסיבוב נרשמים ביומן הביקורת עם המבצע והחותמת. הערך לא.