dopplerhq / gitops-secrets-nodejs Goto Github PK
View Code? Open in Web Editor NEWGitOps encrypted secrets workflow for Node.js
License: Apache License 2.0
GitOps encrypted secrets workflow for Node.js
License: Apache License 2.0
Hey guys, this is a great library!
Looking at the generator https://github.com/DopplerHQ/gitops-secrets-nodejs/blob/main/src/secrets-files.js we could potentially add an optional .d.ts
output?
Any reason you already discussed against doing this?
Hi Team,
Trying to spin this up for a nodejs
app and running into issues as we have
"type": "module",
set in our package.json
[nodemon] starting `node src/server.js`
file:///Users/me/code/platform-gateway/lib/secrets.js:3
const secrets = require("gitops-secrets/no-fs");
^
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/me/code/platform-gateway/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///Users/me/code/platform-gateway/lib/secrets.js:3:17
Is there an easy enough way around this ?
Chris :)
Problem:
The exports
field in package.json
is compateble with node v12 and above, so to make it compatible with lower versions I made the below changes and tested it in my project where I use node v10.
Solution:
Create index.js
& no-fs.js
file in same lavel where package.json
is present and put below code in those files as shown below:
// index.js
module.exports = require('./src');
// index.js
module.exports = require('./src/no-fs');
And I have tested the functionality, it works fine.
Please make the changes as soon as possible, waiting to use the library in our projects.
Thank You
Currently, fetch
only accepts DOPPLER_TOKEN
which should be a service token. In case, we wish to use a Service account token with access to multiple projects and multiple configs, fetch can take projected
and config
as arguments.
const secrets = require("gitops-secrets/no-fs");
Above code is creating Module not found error.
In the attached image it can be seen, the getServerSideProps()
(part of NextJs) is trying to call loadSecrets()
which is a auto generated file by gitops-secrets
, but the module is not getting imported correctly & the bellow error occurs
Module not found: Can't resolve 'gitops-secrets/no-fs'
Environment used : NextJs (10.0.5), Node v12.22.12
@ryan-blunden @Piccirello Please help...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.