1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-10 13:23:18 +00:00

Add options for giving passwords and secrets as file contents or in an environment variable (#82)

This commit is contained in:
Pasi Niemi
2021-01-04 18:53:11 +02:00
committed by GitHub
parent 77043d8d66
commit 55722d3c04
2 changed files with 22 additions and 6 deletions

View File

@@ -19,6 +19,8 @@ import { SyncConfiguration } from '../models/syncConfiguration';
import { ConnectorUtils } from '../utils';
import { NodeUtils } from 'jslib/misc/nodeUtils';
export class ConfigCommand {
private directory: DirectoryType;
private ldap = new LdapConfiguration();
@@ -33,6 +35,13 @@ export class ConfigCommand {
async run(setting: string, value: string, cmd: program.Command): Promise<Response> {
setting = setting.toLowerCase();
if (value == null || value === '') {
if (cmd.secretfile) {
value = await NodeUtils.readFirstLine(cmd.secretfile);
} else if (cmd.secretenv && process.env[cmd.secretenv]) {
value = process.env[cmd.secretenv];
}
}
try {
switch (setting) {
case 'server':