v1
Double column
API
CLI
JS Client

Services /

Edit service runtime environment

Sets the runtime environment for the given service.

Required permission

Project > Services > Configuration > Update Environment Variables

Path parameters

    • projectId

      string required

      ID of the project

    • serviceId

      string required

      ID of the service

Request body

  • {object}

    A basic example

    • runtimeEnvironment

      {object} required

      An object containing the all of the environment variables to set for the service. Keys must only contain letters and numbers separated with underscores, may not start with a number

    OR
    • {object}

      An advanced example using secret files

      • runtimeEnvironment

        {object} required

        An object containing the all of the environment variables to set for the service. Keys must only contain letters and numbers separated with underscores, may not start with a number

        • runtimeFiles

          {object}

          Secret files as JSON object, encrypted at rest. File path must be absolute

        Response body

        • {object}

          Response object.

          • data

            {object} required

            Result data.

            • success

              boolean required

              True if the operation was successful.

            • restartSuccessful

              boolean required

              Did the service successfully restart with the new environment variables?

        API
        CLI
        JS Client

        POST /v1/projects/{projectId}/services/{serviceId}/runtime-environment

        Example request

        Request body
        A basic example
        curl
        curl --header "Content-Type: application/json" \
          --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
          --request POST \
          --data '{"runtimeEnvironment":{"VARIABLE_1":"abcdef","VARIABLE_2":"12345"}}' \
          http://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/runtime-environment
        OR
        An advanced example using secret files
        curl
        curl --header "Content-Type: application/json" \
          --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
          --request POST \
          --data '{"runtimeEnvironment":{"VARIABLE_1":"abcdef","VARIABLE_2":"12345"},"runtimeFiles":{"/dir/fileName":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}}}' \
          http://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/runtime-environment

        Example response

        200 OK

        Details about the updated runtime environment.

        JSON

        {
          "data": {
            "success": true,
            "restartSuccessful": true
          }
        }

        © 2022 Northflank Ltd. All rights reserved.