Docker and HTTPHEaders

I am running the docker and after docker run . . . through an .sh process , i am trying to add the httpheaders so as to make an api call through my project, which runs on locahost:3000. I found it a little bit confusing since, after docker run . . ., ipfs daemon running right away and i dont know the exact time that this process will take , that’s why i can run
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin “[$ALLOW_ORIGINS]”
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods ‘[“PUT”, “GET”, “POST”]’
and after that restart daemon. Is there any easy way?

Not really :frowning:
My suggestion would be to persist the configuration in a volume so you don’t have to do it every time.
If you instead mount a local directory as $IPFS_PATH, then you can easily persist also the configuration locally and edit it directly on your computer

I did it already. So I will follow your suggestion. What about implement ipfs-js on my node.js instead of running the docker, are there any precautions? Because I’ ve read that is not suggested.

I just thought that if you are running IPFS in docker, you might need to expose the ports and ensure that IPFS is configure to listen to 0.0.0.0 instead of 127.0.0.1

Is this helping?

In any case my suggestion would be to run go-ipfs instead of js-ipfs as the go implementation has, AFAIK, a lot more features… probably things have improved and I am wrong :slight_smile: