Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added environment variable override for storage dir #712

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/generator-cli/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Further it is also possible to configure generators, for example:
"spaces": 2,
"generator-cli": {
"version": "4.3.1",
"storageDir": "~/my/custom/storage/dir", // optional
"storageDir": "~/my/custom/storage/dir", // optional, where the JAR file will be located/downloaded
"generators": { // optional
"v2.0": { // any name you like (just printed to the console log or reference it using --generator-key)
"generatorName": "typescript-angular",
Expand Down Expand Up @@ -176,6 +176,12 @@ is automatically used to generate your code. 🎉
| relPath | file name and extension of file relative to the glob provided | docs/auth.yaml |
| ext | just file extension | yaml |

### Environment variables

The following environment variables can be provided to override the config file:

- `OPENAPI_GENERATOR_STORAGE_DIR`: Overrides the storageDir property.

### Using custom / private maven registry

If you're using a private maven registry you can configure the `downloadUrl` and `queryUrl` like this:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const mvn = {
@Injectable()
export class VersionManagerService {

private customStorageDir = this.configService.get<string>('generator-cli.storageDir');
private customStorageDir = process.env.OPENAPI_GENERATOR_STORAGE_DIR || this.configService.get<string>('generator-cli.storageDir');

public readonly storage = this.customStorageDir ? path.resolve(
this.configService.cwd,
Expand Down