Ok, here is what I did.
- Reinstall Vault, something happened to storage because I did a lot of attempts and commands in it.
- Enable secrets engine in specific path
vault secrets enable -path=testPath kv
- Write to this path
Configure:
export const VAULT_OPTIONS = {
apiVersion: 'v1',
endpoint: 'http://127.0.0.1:8200',
token: '<<YOUR TOKEN>>'
};
vault = require("node-vault")(VAULT_OPTIONS);
Write:
this.vault.write('test/data/mykey', {"data": {"tests": {"test1": "test1-value", "test2": "test2-value"}}}).then(
(result: any) => {
console.log(res.data);
}, (error: any) => {
console.log(error);
});
Please note that path
must contain data
and data must be surounded by data
({ data: {key:value}) as well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…