Envers เป็นเครื่องมือ Command-Line (CLI) ที่ออกแบบมาเพื่อจัดการและตัวแปรสภาพแวดล้อมเวอร์ชันสำหรับขั้นตอนการปรับใช้ที่แตกต่างกันเช่นการจัดเตรียมการพัฒนาและการผลิต มันมีวิธีที่ปลอดภัยและเป็นระเบียบในการจัดการการกำหนดค่าเฉพาะสภาพแวดล้อม
TBD
ด้านล่างนี้เป็นคำสั่งย่อยเริ่มต้นสำหรับ envers :
envers init : เริ่มต้นสภาพแวดล้อม enversenvers deploy <spec version number> : ปรับใช้เวอร์ชันเฉพาะจากไฟล์ Specenvers draft <spec version number> : สร้างร่างเวอร์ชันใหม่ในไฟล์ข้อมูลจำเพาะ บางตัวแปรของคำสั่งนี้:envers draft <spec version number> --from <previous spec version number>envers draft <spec version number> --from-env .envenvers profile-set --profile <profile_name> --spec <version_number> : เพิ่มเนื้อหาใหม่envers profile load --profile prod --spec <spec version> : โหลดโปรไฟล์สภาพแวดล้อมเฉพาะไปยังไฟล์ envers init สร้างไฟล์ข้อมูลจำเพาะที่ .envers/.specs.yaml
envers deploy สร้างไฟล์ .envers/.data.lock ไฟล์นี้ถูกสร้างขึ้นโดยอัตโนมัติโดยคำสั่ง envers และมีการเข้ารหัส
เวอร์ชันเริ่มต้นของ ./.envers/.specs.yaml จะมีลักษณะเช่นนี้:
version : 0.1 # the envers spec version
releases :อย่างที่คุณเห็นมันไม่มีข้อมูลมากเกินไป หากคุณต้องการร่างเวอร์ชันใหม่คุณสามารถเรียกใช้คำสั่งต่อไปนี้:
$ envers draft 1.0 หลังจากคำสั่งนี้ไฟล์ .envers/specs.yaml ควรมีลักษณะเช่นนี้:
version : 0.1 # the spec version
releases :
# placeholder: the version for the environment variables.
# if the status is draft, feel free to change the version number
1.0 :
# status attribute is handled by command line, don't change it manually
status : draft # options are: draft, cancelled, deployed
# placeholder: update help with the real help text
help :
# placeholder: a list of available profiles (groups) for this version.
# at least one profile is required for the deploying
profiles :
- base
# define the spec for that version, this spec should be used for all
# profiles (groups) inside this version
spec :
# define the env file or any other kind of environment file to be used,
# for now it just has support for .env files
files :
# placeholder: change `.env` to the correct dotenv file relative path
.env :
type : dotenv # default
# `vars` is a dictionary for the environment variables
# this defines the variables and some metadata, but not the real
# value, because it is just the definition of the spec.
vars :
# placeholder: ENV is just a variable name, replace it by your real
# environment variable
ENV :
type : string # options are: string, int, bool, path
default : dev # in the case that the variable is not definedตอนนี้คุณสามารถปรับใช้ตัวแปรสภาพแวดล้อมรุ่นแรกของคุณ:
$ envers deploy 1.0 เมื่อมีการปรับใช้เวอร์ชันจะสร้างสเป็คใหม่ทั้งหมดลงใน. .envers/data.lock โดยอัตโนมัติ
ตัวแปรทั้งหมดสำหรับแต่ละโปรไฟล์และเวอร์ชันสเป็คจะถูกเก็บไว้ใน .envers/data.lock และไฟล์นี้ไม่ควรเปลี่ยนไม่ว่าด้วยเหตุผลใดก็ตาม
ในที่สุดเราสามารถสร้างตัวแปรสภาพแวดล้อมสำหรับโปรไฟล์ base :
$ envers profile set --profile base --spec 1.0 envers จะถามคุณผ่านทางพร้อมท์ค่าสำหรับแต่ละตัวแปรที่กำหนดไว้ในสเป็คสำหรับเวอร์ชัน 1.0
https://osl-incubator.github.io/envers
BSD-clause 3