github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/docs/konnectors-dev.md (about)

     1  [Table of contents](README.md#table-of-contents)
     2  
     3  
     4  # running a konnector locally
     5  
     6  
     7  
     8  ## Locally but linked to a Cozy
     9  
    10  This method requires a working cozy-stack. It will allow you to run the konnector
    11  outside the cozy-stack but saves the data inside the cozy-stack. This can be useful
    12  when your konnector is not available in one of the registries but you still want to save
    13  you data in your real Cozy.
    14  
    15  You can find a detailed explanation inside the [linking your konnector to a cozy](https://docs.cozy.io/en/tutorials/konnector/save-data/#linking-your-connector-to-a-cozy-dev-mode)
    16  page.
    17  
    18  
    19  
    20  ## Installed from a local directory
    21  
    22  This method requires a working cozy-stack with the admin permissions and the cozy-stack 
    23  CLI. It will allow you to install your konnector exactly like it was published in a registry. This 
    24  can be a good way to check locally if everything works well before publishing 
    25  to the registry.
    26  
    27  
    28  ### Installing the konnector
    29  
    30  First build it:
    31  
    32  ```
    33  yarn build
    34  ```
    35  
    36  Start your cozy-stack server with the `--dev` flag. If you have the cozy-stack source code
    37  locally you can run this following command for example:
    38  ```
    39  go run . serve --dev --config ~/.config/cozy/config.yaml --mailhog --fs-url=file://localhost${PWD}/storage --konnectors-cmd ${PWD}/scripts/konnector-dev-run.sh
    40  ```
    41  
    42  > You will need to have a valid [configuration file](./config.md).
    43  
    44  
    45  Then you just have to run:
    46  
    47  ```
    48  cozy-stack konnectors install <slug> files://<konnector folder absolute path>/build
    49  ```
    50  
    51  > Be careful to point the `/build` folder inside your konnector folder!
    52  
    53  
    54  ### Run the konnector
    55  
    56  Once connected to your Cozy instance (probably `http://cozy.localhost:8080`) you should 
    57  have a new icon with your konnector name. Once you click on it, you will be asked the informations 
    58  required to run the konnector. Once saved, the konnector will start running.
    59  
    60  
    61  > After modifying the konnector, clicking on the `Synchronize` button will fetch
    62  the new code an run it with the changes.