Open mhkarimi1383 opened 2 years ago
I think an API itself would be out-of-scope for this project, as it's a client-side tool built for the browser.
That being said, we do have the config generators themselves exposed in such a way that it'd likely be pretty simple for someone to add a CLI interface to the project that just reads in a large config JSON file (similar to the JSON data stored in the URL when using the in-browser version) and running it through the generators: https://github.com/digitalocean/nginxconfig.io/tree/master/src/nginxconfig/generators
Me too
@MattIPv4 Maybe a CLI can be work as a NPM package.
But I don't sure about some things
Where storage the files?
As in, within the repo? src/nginxconfig/cli
feels like the logical location. Assuming the correct bin
entry is added to the package.json
, it doesn't actually matter where the entrypoint script is.
How the files can be generate?
I would probably expect the CLI to take a directory argument, and the CLI then writes the files directly to there. I like the idea of adding an optional --tar
flag though that outputs the single tar file instead.
The ifs in the generator using computed value, how can simulate that in Node CLI?
Some logic will need to be written that takes the provided JSON data and gives each property a new sub-object with the value as the computed
property. OR, the opposite could be done where the generators are updated to remove the computed
property, and the data from the Vue client is transformed to remove that property before being passed to the generators.
Where storage the files?
As in, within the repo?
src/nginxconfig/cli
feels like the logical location. Assuming the correctbin
entry is added to thepackage.json
, it doesn't actually matter where the entrypoint script is.How the files can be generate?
I would probably expect the CLI to take a directory argument, and the CLI then writes the files directly to there. I like the idea of adding an optional
--tar
flag though that outputs the single tar file instead.The ifs in the generator using computed value, how can simulate that in Node CLI?
Some logic will need to be written that takes the provided JSON data and gives each property a new sub-object with the value as the
computed
property. OR, the opposite could be done where the generators are updated to remove thecomputed
property, and the data from the Vue client is transformed to remove that property before being passed to the generators.
I would love to have it as a parameter since I want to use it within my automation scripts or my ansible plays Also would be nice to get all of the parameters as a yaml or json file or using environment variables
Yah, I'd expect this to take a JSON file as the config input (representing what you normally be in the UI):
nginxconfig --config whatever.json --out /etc/nginx
hey @MattIPv4 i would like to work on this is this issue still open to work?
Go for it 👍
Feature request
Just a simple API giving parameters and return the confirmation
Feature description
For automation reasons I need such API for that reason
How the feature is useful
Using Automation tools like Ansible or making a simple cli