chore(env): add VITE_DEFAULT_DATA_TO_ENCODE variable to .env.example, README, docker-compose.yml, and env.d.ts files to provide a default data value for encoding in the app (#170)
fix(QRCodeCreate.vue): update data initialization to use VITE_DEFAULT_DATA_TO_ENCODE value from environment variables if available, ensuring a default data value for encoding in the QR code creation component
This commit is contained in:
parent
c5a9bf91c8
commit
d2d59059b4
@ -10,7 +10,8 @@ BASE_PATH=/
|
|||||||
|
|
||||||
VITE_HIDE_CREDITS=false
|
VITE_HIDE_CREDITS=false
|
||||||
VITE_DEFAULT_PRESET=plain
|
VITE_DEFAULT_PRESET=plain
|
||||||
|
VITE_DEFAULT_DATA_TO_ENCODE=
|
||||||
VITE_QR_CODE_PRESETS=
|
VITE_QR_CODE_PRESETS=
|
||||||
VITE_FRAME_PRESET=
|
VITE_FRAME_PRESET=
|
||||||
VITE_FRAME_PRESETS=
|
VITE_FRAME_PRESETS=
|
||||||
VITE_DISABLE_LOCAL_STORAGE=false
|
VITE_DISABLE_LOCAL_STORAGE=false
|
||||||
|
19
README.md
19
README.md
@ -140,15 +140,16 @@ docker run -d -p 8081:8080 mini-qr
|
|||||||
|
|
||||||
#### Environment Variables
|
#### Environment Variables
|
||||||
|
|
||||||
| Variable | Description | Default |
|
| Variable | Description | Default |
|
||||||
| ---------------------------- | ---------------------------------------------------------------------------------- | --------- |
|
| ----------------------------- | ---------------------------------------------------------------------------------- | --------- |
|
||||||
| `BASE_PATH` | Base path for deployment | `/` |
|
| `BASE_PATH` | Base path for deployment | `/` |
|
||||||
| `VITE_HIDE_CREDITS` | Set to `"true"` to hide credits in the footer | `"false"` |
|
| `VITE_HIDE_CREDITS` | Set to `"true"` to hide credits in the footer | `"false"` |
|
||||||
| `VITE_DEFAULT_PRESET` | Name of the default QR code preset to load (e.g., `"lyqht"`) | `""` |
|
| `VITE_DEFAULT_PRESET` | Name of the default QR code preset to load (e.g., `"lyqht"`) | `""` |
|
||||||
| `VITE_QR_CODE_PRESETS` | JSON string defining custom QR code presets. E.g., `'[{"name":"c1","data":"hi"}]'` | `"[]"` |
|
| `VITE_DEFAULT_DATA_TO_ENCODE` | Default data to encode when the app first loads | `""` |
|
||||||
| `VITE_FRAME_PRESET` | Name of the default frame preset to load (e.g., `"default"`) | `""` |
|
| `VITE_QR_CODE_PRESETS` | JSON string defining custom QR code presets. E.g., `'[{"name":"c1","data":"hi"}]'` | `"[]"` |
|
||||||
| `VITE_FRAME_PRESETS` | JSON string defining custom frame presets. E.g., `'[{"name":"fA","text":"QR"}]'` | `"[]"` |
|
| `VITE_FRAME_PRESET` | Name of the default frame preset to load (e.g., `"default"`) | `""` |
|
||||||
| `VITE_DISABLE_LOCAL_STORAGE` | Set to `"true"` to disable loading saved settings from local storage on startup | `"false"` |
|
| `VITE_FRAME_PRESETS` | JSON string defining custom frame presets. E.g., `'[{"name":"fA","text":"QR"}]'` | `"[]"` |
|
||||||
|
| `VITE_DISABLE_LOCAL_STORAGE` | Set to `"true"` to disable loading saved settings from local storage on startup | `"false"` |
|
||||||
|
|
||||||
### Docker configuration
|
### Docker configuration
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ services:
|
|||||||
- VITE_HIDE_CREDITS=${HIDE_CREDITS:-false}
|
- VITE_HIDE_CREDITS=${HIDE_CREDITS:-false}
|
||||||
- BASE_PATH=${BASE_PATH:-/}
|
- BASE_PATH=${BASE_PATH:-/}
|
||||||
- VITE_DEFAULT_PRESET=${DEFAULT_PRESET:-}
|
- VITE_DEFAULT_PRESET=${DEFAULT_PRESET:-}
|
||||||
|
- VITE_DEFAULT_DATA_TO_ENCODE=${DEFAULT_DATA:-}
|
||||||
- VITE_QR_CODE_PRESETS=${PRESETS:-}
|
- VITE_QR_CODE_PRESETS=${PRESETS:-}
|
||||||
- VITE_FRAME_PRESET=${FRAME_PRESET:-}
|
- VITE_FRAME_PRESET=${FRAME_PRESET:-}
|
||||||
- VITE_FRAME_PRESETS=${FRAME_PRESETS:-}
|
- VITE_FRAME_PRESETS=${FRAME_PRESETS:-}
|
||||||
|
1
env.d.ts
vendored
1
env.d.ts
vendored
@ -4,6 +4,7 @@ interface ImportMetaEnv {
|
|||||||
readonly BASE_PATH?: string
|
readonly BASE_PATH?: string
|
||||||
readonly VITE_HIDE_CREDITS?: string
|
readonly VITE_HIDE_CREDITS?: string
|
||||||
readonly VITE_DEFAULT_PRESET?: string
|
readonly VITE_DEFAULT_PRESET?: string
|
||||||
|
readonly VITE_DEFAULT_DATA_TO_ENCODE?: string
|
||||||
readonly VITE_QR_CODE_PRESETS?: string
|
readonly VITE_QR_CODE_PRESETS?: string
|
||||||
readonly VITE_FRAME_PRESET?: string
|
readonly VITE_FRAME_PRESET?: string
|
||||||
readonly VITE_FRAME_PRESETS?: string
|
readonly VITE_FRAME_PRESETS?: string
|
||||||
|
@ -65,7 +65,7 @@ const { t } = useI18n()
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region /* QR code style settings */
|
//#region /* QR code style settings */
|
||||||
const data = ref(props.initialData || '')
|
const data = ref(props.initialData || import.meta.env.VITE_DEFAULT_DATA_TO_ENCODE || '')
|
||||||
const debouncedData = ref(data.value)
|
const debouncedData = ref(data.value)
|
||||||
let dataDebounceTimer: ReturnType<typeof setTimeout>
|
let dataDebounceTimer: ReturnType<typeof setTimeout>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user