captainhook icon indicating copy to clipboard operation
captainhook copied to clipboard

Invalid configuration path

Open nepster-web opened this issue 3 years ago • 6 comments

I configured captainhook and I get an error with the configuration path.

изображение

This is due to the wrong path: изображение

The right path for me: /api/captainhook.json (with slash)

but I can't put it in any way.

My command: captainhook install -f -s -c "/api/captainhook.json"

the first slash is always ignored

nepster-web avatar May 17 '21 17:05 nepster-web

https://github.com/captainhookphp/captainhook/blob/64b405d6ad85a3ac8484e7e2a3a9b14b180a1bd6/src/Hook/Template/Docker.php#L87

this is where the slash is lost

nepster-web avatar May 17 '21 17:05 nepster-web

I know it is a bit counter intuitive that the relative path is used no matter what you do and especially for docker setups it would be best to use absolute path anyway. I will do some testing and make sure everything still works if I use the absolute path in that position. But this will take a bit of time.

In the meantime, you can specify the working directory for the docker exec command or define a default working dir in your container file.

Add working directory to exec command

{
  "config": {
    "run-mode": "docker",
    "run-exec": "docker exec CONTAINER_NAME --workdir=/"
  },
  ...
}

Define container working directory in your docker file

WORKDIR /

sebastianfeldmann avatar May 17 '21 19:05 sebastianfeldmann

@sebastianfeldmann, so, what is the verdict?

nepster-web avatar Jun 21 '21 19:06 nepster-web

Have you tried to define your working directory for your container?

sebastianfeldmann avatar Jun 22 '21 10:06 sebastianfeldmann

yes, it will work for WORKDIR /. but this is not a solution to the problem when other WORKDIR.

now I have a lot of crutches in other commands.

изображение

nepster-web avatar Jun 22 '21 20:06 nepster-web

🤔 good point, I will look into it a bit further

sebastianfeldmann avatar Jun 23 '21 07:06 sebastianfeldmann