@agilecustoms/envctl 1.19.2 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands/plan.js
CHANGED
|
@@ -12,7 +12,7 @@ export function plan(program, configService, envService) {
|
|
|
12
12
|
.argument('[args...]')
|
|
13
13
|
.action(wrap(async (tfArgs, options) => {
|
|
14
14
|
const { profile } = options;
|
|
15
|
-
configService.init(profile);
|
|
15
|
+
configService.init(profile, false);
|
|
16
16
|
await envService.plan(tfArgs);
|
|
17
17
|
}));
|
|
18
18
|
}
|
package/dist/container.js
CHANGED
|
@@ -6,8 +6,8 @@ import { ConfigService, EnvService, TerraformAdapter } from './service/index.js'
|
|
|
6
6
|
import { LocalStateService } from './service/LocalStateService.js';
|
|
7
7
|
import { LogService } from './service/LogService.js';
|
|
8
8
|
export function buildContainer(appVersion) {
|
|
9
|
-
const cli = new Cli();
|
|
10
9
|
const configService = new ConfigService();
|
|
10
|
+
const cli = new Cli();
|
|
11
11
|
const backends = [new S3Backend()];
|
|
12
12
|
const commandId = randomUUID();
|
|
13
13
|
const httpClient = new HttpClient(appVersion, commandId, configService);
|
|
@@ -15,7 +15,7 @@ export function buildContainer(appVersion) {
|
|
|
15
15
|
const localStateService = new LocalStateService();
|
|
16
16
|
const nonInteractive = !process.stdout.isTTY || process.env.CI === 'true';
|
|
17
17
|
const terraformAdapter = new TerraformAdapter(Date.now, configService, cli, localStateService, backends, nonInteractive);
|
|
18
|
-
const envService = new EnvService(cli, envApiClient, terraformAdapter);
|
|
18
|
+
const envService = new EnvService(configService, cli, envApiClient, terraformAdapter);
|
|
19
19
|
const logService = new LogService(cli, envApiClient, terraformAdapter);
|
|
20
20
|
return { configService, envService, logService };
|
|
21
21
|
}
|
|
@@ -41,10 +41,10 @@ export class ConfigService {
|
|
|
41
41
|
const configPath = path.join(configDir(), `${profile}.json`);
|
|
42
42
|
fs.writeFileSync(configPath, data);
|
|
43
43
|
}
|
|
44
|
-
init(profile = undefined) {
|
|
44
|
+
init(profile = undefined, requireApiKey = true) {
|
|
45
45
|
this.loadConfig(profile);
|
|
46
46
|
const apiKey = this.getApiKey();
|
|
47
|
-
if (!apiKey) {
|
|
47
|
+
if (!apiKey && requireApiKey) {
|
|
48
48
|
if (!!process.env['CI']) {
|
|
49
49
|
throw new KnownException('API key is missing, set env variable ' + EnvKey.API_KEY);
|
|
50
50
|
}
|
|
@@ -6,10 +6,12 @@ import { EnvStatus } from '../model/index.js';
|
|
|
6
6
|
import { toLocalTime } from '../util.js';
|
|
7
7
|
import { BaseService } from './BaseService.js';
|
|
8
8
|
export class EnvService extends BaseService {
|
|
9
|
+
configService;
|
|
9
10
|
cli;
|
|
10
11
|
envApi;
|
|
11
|
-
constructor(cli, envApi, terraformAdapter) {
|
|
12
|
+
constructor(configService, cli, envApi, terraformAdapter) {
|
|
12
13
|
super(terraformAdapter);
|
|
14
|
+
this.configService = configService;
|
|
13
15
|
this.cli = cli;
|
|
14
16
|
this.envApi = envApi;
|
|
15
17
|
}
|
|
@@ -33,6 +35,9 @@ export class EnvService extends BaseService {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
async tryGetEnv(key) {
|
|
38
|
+
if (this.configService.getApiKey() === undefined) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
36
41
|
logger.info(`Check if env ${key} already exists`);
|
|
37
42
|
const env = await this.envApi.get(key);
|
|
38
43
|
if (env) {
|