Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to set different apidoc.json #719

Closed
yunlucolin opened this issue Apr 12, 2018 · 6 comments
Closed

Is there a way to set different apidoc.json #719

yunlucolin opened this issue Apr 12, 2018 · 6 comments
Labels
enhancement fixed on dev for issues fixed on dev branch

Comments

@yunlucolin
Copy link

Hi!
Working in localhost env, we want to set 'sampleUrl' as the localhost host, to test more easily. While we still need to maintain it frequently, so it's not a good idea to put it in .gitignore.

How about providing an option to set the path for apidoc.json?

Thanks!

@lotas
Copy link

lotas commented May 9, 2018

I also stumbled the same problem generating docs for different environments.
I see there can be several solutions:

  • Generate apidoc.json on the fly for each build (not that good)
  • Have an option to use apidoc.js config, so all the variables could be generated in run-time

Also, according to documentation, there is a config switch, which might work as well, but you'll end up copy-pasting pretty much the whole file

   -c, --config            Path to directory containing config file (apidoc.json)  [./]

@germanow
Copy link

Why do I need to create directory for each apidoc.json? Why do I can't specify path to file?

Something like apidoc -c ./apidoc-test.json would be much better.

@NicolasCARPi
Copy link
Collaborator

I agree that the -c flag should be for a config file, not a directory. For backward compatibility, the code would need to determine if the path is a directory or a file, if a file, use that directly, if a directory, look for the config file inside.

@javajoe1
Copy link

can it use the dotenv lib? We are placing our generated docs into a docker image that can be pushed out to different environments. having dotenv, we can pass in the url/sampleUrl when we startup the docker container.

@NicolasCARPi
Copy link
Collaborator

@javajoe1 Dotenv sounds like a good idea. Please feel free to submit a PR for this feature :)

@abhivishwebdunia
Copy link

I found a solution to specify sampleUrl or any other apidocjson setting as per our application environment.
Suppose we have four env - local,dev,stage,prod
These env will have their specific sampleUrl
Just create apidoc-.json with respect to these env like-
apidoc-local.json
apidoc-dev.json
apidoc-stage.json
apidoc-prod.json
In each we specify their respective setting
Now just write a bash script like apidoc.sh contain following code -

cp apidoc-$1.json apidoc.json
apidoc -f "./src/routes/.*\\.js$" -i ./ -o public/apidoc/
rm apidoc.json

now everytime you want to create apidoc with any environment ,just execute it with following command -
sh ./apidoc.sh <env>
Example -

sh ./apidoc.sh dev 
sh ./apidoc.sh local

by this,it will create apidoc with dynamic environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement fixed on dev for issues fixed on dev branch
Projects
None yet
Development

No branches or pull requests

7 participants