forked from loafle/openapi-generator-original
added environment variable support
This commit is contained in:
parent
723cf9b823
commit
9f842a1295
@ -36,6 +36,7 @@ import config.Config;
|
|||||||
import config.ConfigParser;
|
import config.ConfigParser;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
@ -112,6 +113,9 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
@Parameter(defaultValue = "true")
|
@Parameter(defaultValue = "true")
|
||||||
private boolean addCompileSourceRoot = true;
|
private boolean addCompileSourceRoot = true;
|
||||||
|
|
||||||
|
@Parameter
|
||||||
|
protected Map<String, String> environmentVariables = new HashMap<String, String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project being built.
|
* The project being built.
|
||||||
*/
|
*/
|
||||||
@ -125,6 +129,12 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
CodegenConfig config = CodegenConfigLoader.forName(language);
|
CodegenConfig config = CodegenConfigLoader.forName(language);
|
||||||
config.setOutputDir(output.getAbsolutePath());
|
config.setOutputDir(output.getAbsolutePath());
|
||||||
|
|
||||||
|
if (environmentVariables != null) {
|
||||||
|
for(String key : environmentVariables.keySet()) {
|
||||||
|
System.setProperty(key, environmentVariables.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (null != templateDirectory) {
|
if (null != templateDirectory) {
|
||||||
config.additionalProperties().put(TEMPLATE_DIR_PARAM, templateDirectory.getAbsolutePath());
|
config.additionalProperties().put(TEMPLATE_DIR_PARAM, templateDirectory.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user