Skip to content

Commit 2abae74

Browse files
authored
Add clarifying information for CurseForge API keys (#3594)
1 parent a569d63 commit 2abae74

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

docs/types-and-platforms/mod-platforms/auto-curseforge.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
1212

1313
Example if your key is `$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa`:
1414
```yaml
15+
# compose.yaml
1516
environment:
1617
CF_API_KEY: '$$11$$22$$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
1718
```
@@ -21,25 +22,43 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
2122
docker run ... -e CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
2223
```
2324

24-
To avoid exposing the API key, it is highly recommended to use a `.env` file, which is [loaded automatically by docker compose](https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file). `$`'s in the value still need to escaped with a second `$` and the variable needs to be referenced from the compose file, such as:
25+
To avoid exposing the API key, it is highly recommended to use a `.env` file, which is [loaded automatically by docker compose](https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file). You **do not** need to escape `$`'s with a second `$` in the `.env` file **as long as the key is wrapped in single quotes**.
26+
27+
```
28+
# .env
29+
CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
30+
```
31+
32+
The variable should to be referenced from the compose file, such as:
33+
2534
```yaml
35+
# compose.yaml
2636
environment:
2737
CF_API_KEY: ${CF_API_KEY}
2838
```
2939

40+
The .env file should be placed in the same directory as your compose file like so:
41+
42+
```
43+
/minecraft-server
44+
├── .env
45+
├── compose.yaml
46+
├── /data
47+
```
48+
3049
To use the equivalent with `docker run` you need to specify the `.env` file explicitly:
3150
```
3251
docker run --env-file=.env itzg/minecraft-server
3352
```
34-
53+
3554
Alternately you can use [docker secrets](https://docs.docker.com/compose/how-tos/use-secrets/) with a `CF_API_KEY_FILE` environment variable:
3655
```
3756
service:
3857
environment:
3958
CF_API_KEY_FILE: /run/secrets/cf_api_key
4059
secrets:
4160
- cf_api_key
42-
61+
4362
secrets:
4463
cf_api_key:
4564
file: cf_api_key.secret

0 commit comments

Comments
 (0)