<commit_before># Creates Magpie services with specified configuration values on application startup.
#
#   See documentation 'Configuration' for detail about loading method, order and other relevant information.
#
#   - Default location is 'magpie/config/providers.cfg'.
#   - Directory location can be overridden with 'MAGPIE_CONFIG_DIR' (using filename 'providers.cfg')
#     or can be explicitly overridden with 'MAGPIE_PROVIDERS_CONFIG_PATH' pointing to a valid file.
#   - If 'MAGPIE_PROVIDERS_CONFIG_PATH' points to an existing directory, the application will attempt
#     to process all '.cfg' files found under it one-by-one as separate 'providers' configurations.
#
# Parameters:
# -----------
#   url:        private URL of the service to be created
#   title:      pretty name of the service (real name is the section key)
#   public:     parameter passed down to Phoenix for service registration
#   c4i:        parameter passed down to Phoenix for service registration
#   type:       service type to use for creation, must be one of the known Magpie service types
#               (see: magpie.services.SERVICE_TYPE_DICT)
#   sync_type:  service synchronization type, must be one of the known Magpie service sync-types,
#               often equals to 'type' (see: magpie.cli.SYNC_SERVICES_TYPES)
#   hooks:      list of request processing hooks for the service
#
# Hooks: (requires Magpie>=3.25.0, Twitcher>=0.7.0)
# ------
#   When items are specified and that the *original* request filters match a configuration, the processing hooks are
#   applied onto the proxied request or response using it. Each hook definition must be provided using the following
#   structure under the relevant service.
#
#   hooks:
#     - type: <HOOK_TYPE>         [required] (request|response)
#       path: <PROXIED_PATH>      [required] service-specific request path / regex pattern (after proxy prefix path)
#       query: <HTTP_QUERY>       [optional] request query string / regex pattern excluding '?' prefix (default: ".*")
#       method: <HTTP_METHOD>     [optional] (HEAD|GET|POST|PUT|PATCH|DELETE|*) (default: "*")
#       target: <FUNCTION_PATH>   [required] location of function to handle hook processing
#                                            path should be absolute or relative to MAGPIE_ROOT
#                                            (format: 'some/path/script.py:func')
#     - <next hook>
#     - <...>
#
#   Functions defined by request/response hook must respectively take as input the active request/response in the
#   processing chain and return an equivalent request/response with desired modifications applied for following ones.
#   Furthermore, they can specify an optional argument for the service definition that triggered the hook function.
#   Permitted signatures of hooks are presented in:
#   https://pavics-magpie.readthedocs.io/en/latest/configuration.html#service-hooks
#
#   Each hook that matches is applied iteratively in the listed order, allowing successive modifications of the
#   request/responses as needed. When all request hooks are processed, the request is sent to the proxied service to
#   obtain the response. This response then uses the same matching of the original request to apply response hook
#   processing chain. The final response is returned if all steps succeeded all returned the expected request/response
#   instances. If an error occurs or forbidden access happens during the request, following hooks are skipped entirely.
#
# Default behaviour:
# ------------------
#   - create missing service with specified parameters.
#   - skip already existing services matched by name and 'url'.
#   - services matched by name but with different 'url' value are updated with the new value.
#   - update of other parameters not supported.
#   - removal of service not supported (must be done manually).
#   - environment variables (formatted as `$name` or `${name}`) are expanded if they are matched in the environment.
#
providers:
  catalog:
    url: http://${HOSTNAME}:8086/pywps
    title: Catalog
    public: true
    c4i: false
    type: wps
    sync_type: wps

  malleefowl:
    url: http://${HOSTNAME}:8091/wps
    title: Malleefowl
    public: true
    c4i: false
    type: wps
    sync_type: wps

  lb_flyingpigeon:
    url: http://${HOSTNAME}:58093/wps
    title: Load_Balanced_Flyingpigeon
    public: true
    c4i: false
    type: wps
    sync_type: wps

  thredds:
    url: http://${HOSTNAME}:8083/thredds
    title: Thredds
    public: true
    c4i: false
    type: thredds
    sync_type: thredds

  ncWMS2:
    url: http://${HOSTNAME}:8080/ncWMS2
    title: ncWMS2
    public: true
    c4i: false
    type: ncwms
    sync_type: ncwms

  geoserverwms:
    url: http://${HOSTNAME}:8087/geoserver
    title: geoserverwms
    public: true
    c4i: false
    type: geoserverwms
    sync_type: geoserverwms

  geoserver:
    url: http://${HOSTNAME}:8087/geoserver
    title: geoserver
    public: true
    c4i: false
    type: wfs
    sync_type: wfs

  geoserver-web:
    url: http://${HOSTNAME}:8087/geoserver/web/
    title: geoserver-web
    public: true
    c4i: false
    type: access
    sync_type: access

  geoserver-api:
    url: http://${HOSTNAME}:8087/geoserver/rest
    title: geoserver-api
    public: true
    c4i: false
    type: api
    sync_type: geoserver-api

  project-api:
    url: http://${HOSTNAME}:3005/api
    title: project-api
    public: true
    c4i: false
    type: api
    sync_type: project-api

  weaver:
    url: http://${HOSTNAME}:4001
    title: weaver-ogc-api-processes
    public: true
    c4i: false
    type: api
    sync_type: api
    hooks:
      # NOTE: 'target' relative to MAGPIE_ROOT, not this file position
      # below hooks are used for testing adapter functionalities
      - type: request
        path: "/processes/[\w_-]+/jobs"
        method: POST
        target: tests/hooks/request_hooks.py:add_x_wps_output_context
      - type: request
        path: "/jobs"
        method: POST
        target: tests/hooks/request_hooks.py:add_x_wps_output_context
      - type: response
        path: "/processes/[\w_-]+/jobs/[a-z0-9-]+"
        method: GET
        target: tests/hooks/request_hooks.py:add_x_wps_output_link
      - type: response
        path: "/jobs/[a-z0-9-]+"
        method: GET
        target: tests/hooks/request_hooks.py:add_x_wps_output_link
      - type: response
        path: "/jobs/[a-z0-9-]+"
        method: GET
        target: tests/hooks/request_hooks.py:combined_arguments<commit_msg>fix double escape config regexes<commit_after># Creates Magpie services with specified configuration values on application startup.
#
#   See documentation 'Configuration' for detail about loading method, order and other relevant information.
#
#   - Default location is 'magpie/config/providers.cfg'.
#   - Directory location can be overridden with 'MAGPIE_CONFIG_DIR' (using filename 'providers.cfg')
#     or can be explicitly overridden with 'MAGPIE_PROVIDERS_CONFIG_PATH' pointing to a valid file.
#   - If 'MAGPIE_PROVIDERS_CONFIG_PATH' points to an existing directory, the application will attempt
#     to process all '.cfg' files found under it one-by-one as separate 'providers' configurations.
#
# Parameters:
# -----------
#   url:        private URL of the service to be created
#   title:      pretty name of the service (real name is the section key)
#   public:     parameter passed down to Phoenix for service registration
#   c4i:        parameter passed down to Phoenix for service registration
#   type:       service type to use for creation, must be one of the known Magpie service types
#               (see: magpie.services.SERVICE_TYPE_DICT)
#   sync_type:  service synchronization type, must be one of the known Magpie service sync-types,
#               often equals to 'type' (see: magpie.cli.SYNC_SERVICES_TYPES)
#   hooks:      list of request processing hooks for the service
#
# Hooks: (requires Magpie>=3.25.0, Twitcher>=0.7.0)
# ------
#   When items are specified and that the *original* request filters match a configuration, the processing hooks are
#   applied onto the proxied request or response using it. Each hook definition must be provided using the following
#   structure under the relevant service.
#
#   hooks:
#     - type: <HOOK_TYPE>         [required] (request|response)
#       path: <PROXIED_PATH>      [required] service-specific request path / regex pattern (after proxy prefix path)
#       query: <HTTP_QUERY>       [optional] request query string / regex pattern excluding '?' prefix (default: ".*")
#       method: <HTTP_METHOD>     [optional] (HEAD|GET|POST|PUT|PATCH|DELETE|*) (default: "*")
#       target: <FUNCTION_PATH>   [required] location of function to handle hook processing
#                                            path should be absolute or relative to MAGPIE_ROOT
#                                            (format: 'some/path/script.py:func')
#     - <next hook>
#     - <...>
#
#   Functions defined by request/response hook must respectively take as input the active request/response in the
#   processing chain and return an equivalent request/response with desired modifications applied for following ones.
#   Furthermore, they can specify an optional argument for the service definition that triggered the hook function.
#   Permitted signatures of hooks are presented in:
#   https://pavics-magpie.readthedocs.io/en/latest/configuration.html#service-hooks
#
#   Each hook that matches is applied iteratively in the listed order, allowing successive modifications of the
#   request/responses as needed. When all request hooks are processed, the request is sent to the proxied service to
#   obtain the response. This response then uses the same matching of the original request to apply response hook
#   processing chain. The final response is returned if all steps succeeded all returned the expected request/response
#   instances. If an error occurs or forbidden access happens during the request, following hooks are skipped entirely.
#
# Default behaviour:
# ------------------
#   - create missing service with specified parameters.
#   - skip already existing services matched by name and 'url'.
#   - services matched by name but with different 'url' value are updated with the new value.
#   - update of other parameters not supported.
#   - removal of service not supported (must be done manually).
#   - environment variables (formatted as `$name` or `${name}`) are expanded if they are matched in the environment.
#
providers:
  catalog:
    url: http://${HOSTNAME}:8086/pywps
    title: Catalog
    public: true
    c4i: false
    type: wps
    sync_type: wps

  malleefowl:
    url: http://${HOSTNAME}:8091/wps
    title: Malleefowl
    public: true
    c4i: false
    type: wps
    sync_type: wps

  lb_flyingpigeon:
    url: http://${HOSTNAME}:58093/wps
    title: Load_Balanced_Flyingpigeon
    public: true
    c4i: false
    type: wps
    sync_type: wps

  thredds:
    url: http://${HOSTNAME}:8083/thredds
    title: Thredds
    public: true
    c4i: false
    type: thredds
    sync_type: thredds

  ncWMS2:
    url: http://${HOSTNAME}:8080/ncWMS2
    title: ncWMS2
    public: true
    c4i: false
    type: ncwms
    sync_type: ncwms

  geoserverwms:
    url: http://${HOSTNAME}:8087/geoserver
    title: geoserverwms
    public: true
    c4i: false
    type: geoserverwms
    sync_type: geoserverwms

  geoserver:
    url: http://${HOSTNAME}:8087/geoserver
    title: geoserver
    public: true
    c4i: false
    type: wfs
    sync_type: wfs

  geoserver-web:
    url: http://${HOSTNAME}:8087/geoserver/web/
    title: geoserver-web
    public: true
    c4i: false
    type: access
    sync_type: access

  geoserver-api:
    url: http://${HOSTNAME}:8087/geoserver/rest
    title: geoserver-api
    public: true
    c4i: false
    type: api
    sync_type: geoserver-api

  project-api:
    url: http://${HOSTNAME}:3005/api
    title: project-api
    public: true
    c4i: false
    type: api
    sync_type: project-api

  weaver:
    url: http://${HOSTNAME}:4001
    title: weaver-ogc-api-processes
    public: true
    c4i: false
    type: api
    sync_type: api
    hooks:
      # NOTES:
      # - each 'target' is relative to MAGPIE_ROOT, not this file's position
      # - below hooks are used for testing adapter functionalities
      # - when using regex special characters (eg: \w), double escape is required due to YAML escape characters
      - type: request
        path: "/processes/[\\w_-]+/jobs"
        method: POST
        target: tests/hooks/request_hooks.py:add_x_wps_output_context
      - type: request
        path: "/jobs"
        method: POST
        target: tests/hooks/request_hooks.py:add_x_wps_output_context
      - type: response
        path: "/processes/[\\w_-]+/jobs/[a-z0-9-]+"
        method: GET
        target: tests/hooks/request_hooks.py:add_x_wps_output_link
      - type: response
        path: "/jobs/[a-z0-9-]+"
        method: GET
        target: tests/hooks/request_hooks.py:add_x_wps_output_link
      - type: response
        path: "/jobs/[a-z0-9-]+"
        method: GET
        target: tests/hooks/request_hooks.py:combined_arguments
{'fraction_non_alphanumeric': 0.09064106440882976, 'fraction_numerical': 0.011037193831267009, 'mean_word_length': 2.8636098130841123, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '617054', 'n_tokens_mistral': 3970, 'n_tokens_neox': 3869, 'n_words': 1345}