mirror of https://github.com/cocosolos/lsd.git
Fix tracking issues with .env
This commit is contained in:
parent
2827a0363e
commit
dcd8479c79
|
|
@ -1 +1 @@
|
|||
.env
|
||||
config
|
||||
|
|
@ -34,8 +34,8 @@ That's it! All the setup is handled for you. Check out the [official LSB documen
|
|||
## Notes
|
||||
|
||||
- If using WSL with Windows, make sure [the project is stored in the WSL file system](https://learn.microsoft.com/en-us/windows/wsl/filesystems#file-storage-and-performance-across-file-systems) for best performance.
|
||||
- To facilitate automatically generating secure database passwords and simplify the setup process, the `.env` file is intentionally empty and untracked by Git.
|
||||
- **Optional** - You can manually populate this _before_ building the containers with these variables:
|
||||
- Secure database passwords and a default user and database name are generated into `config/.env` to simplify the setup process.
|
||||
- **Optional** - You can manually create this _before_ building the containers with these variables:
|
||||
```
|
||||
MARIADB_DATABASE=
|
||||
MARIADB_USER=
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
x-common: &common # Configs used by more than one service.
|
||||
image: lsd_service
|
||||
pull_policy: never
|
||||
env_file: .env # Automatically generated by MariaDB service entrypoint.
|
||||
entrypoint: ["/entrypoint.sh"] # Copies the MariaDB env vars into corresponding LSB settings.
|
||||
environment:
|
||||
XI_NETWORK_HTTP_HOST: 0.0.0.0
|
||||
XI_NETWORK_ZMQ_IP: world
|
||||
XI_NETWORK_SQL_HOST: database
|
||||
volumes: # YAML merge can't be used with sequences, so bind everything here. (SEE NOTE ABOUT WSL IN README!)
|
||||
- ./config:/config
|
||||
- ./.git:/.git # Since LSB is a submodule, we want to preserve
|
||||
- ./server/.git:/server/.git # the directory structure inside the container.
|
||||
- ./server/log:/server/log
|
||||
|
|
@ -26,7 +26,7 @@ services:
|
|||
entrypoint: ["/mariadb-entrypoint.sh"]
|
||||
restart: always
|
||||
volumes:
|
||||
- ./.env:/env/.env
|
||||
- ./config:/config
|
||||
- ./mariadb-entrypoint.sh:/mariadb-entrypoint.sh # Custom entrypoint to generate .env.
|
||||
- ./server/sql:/docker-entrypoint-initdb.d # Initializes the database.
|
||||
- database:/var/lib/mysql
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Export XI_ variables from corresponding MARIADB_ variables.
|
||||
set -a
|
||||
source "/config/.env"
|
||||
set +a
|
||||
export XI_NETWORK_SQL_DATABASE=$MARIADB_DATABASE
|
||||
export XI_NETWORK_SQL_LOGIN=$MARIADB_USER
|
||||
export XI_NETWORK_SQL_PASSWORD="$MARIADB_PASSWORD"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
ENV_FILE="/env/.env"
|
||||
ENV_FILE="/config/.env"
|
||||
|
||||
# Set default values if the .env file is empty.
|
||||
if [ ! -s "$ENV_FILE" ]; then
|
||||
# Set default values if the .env file doesn't exist.
|
||||
if [ ! -e "$ENV_FILE" ]; then
|
||||
MARIADB_DATABASE=xidb
|
||||
MARIADB_USER=xiadmin
|
||||
XI_NETWORK_ENABLE_HTTP=1
|
||||
|
|
|
|||
Loading…
Reference in New Issue