|
7 | 7 | """ |
8 | 8 |
|
9 | 9 | from __future__ import absolute_import |
10 | | -import logging |
11 | 10 | import os |
12 | 11 | import ssl |
13 | 12 | import urllib3 |
14 | 13 | from nipyapi.nifi import configuration as nifi_config |
15 | 14 | from nipyapi.registry import configuration as registry_config |
16 | 15 |
|
17 | 16 |
|
18 | | -# --- Logging ------ |
19 | | -logging.basicConfig(level=logging.WARNING) |
20 | | - |
21 | | - |
22 | 17 | # --- Default Host URLs ----- |
23 | 18 | # Note that changing the default hosts below will not |
24 | 19 | # affect an API connection that's already running. |
25 | 20 | # You'll need to change the .api_client.host for that, and there is a |
26 | 21 | # convenience function for this in nipyapi.utils.set_endpoint |
27 | 22 |
|
28 | 23 | # Set Default Host for NiFi |
29 | | -default_host = 'localhost' # Default to localhost for release |
| 24 | +default_host = "localhost" # Default to localhost for release |
30 | 25 | # |
31 | 26 | nifi_config.host = os.getenv( |
32 | | - 'NIFI_API_ENDPOINT', |
33 | | - 'http://' + default_host + ':8080/nifi-api' |
| 27 | + "NIFI_API_ENDPOINT", "http://" + default_host + ":8080/nifi-api" |
34 | 28 | ) |
35 | 29 | # Set Default Host for NiFi-Registry |
36 | | -registry_config.host = 'http://' + default_host + ':18080/nifi-registry-api' |
| 30 | +registry_config.host = "http://" + default_host + ":18080/nifi-registry-api" |
37 | 31 |
|
38 | 32 | # --- Project Root ------ |
39 | 33 | # Is is helpful to have a reference to the root directory of the project |
|
100 | 94 | # --- Security Context |
101 | 95 | # This allows easy reference to a set of certificates for use in automation |
102 | 96 | # By default it points to our demo certs, change it for your environment |
103 | | -default_certs_path = os.path.join(PROJECT_ROOT_DIR, 'demo/keys') |
| 97 | +default_certs_path = os.path.join(PROJECT_ROOT_DIR, "demo/keys") |
104 | 98 | default_ssl_context = { |
105 | | - 'ca_file': os.path.join(default_certs_path, 'localhost-ts.pem'), |
106 | | - 'client_cert_file': os.path.join(default_certs_path, 'client-cert.pem'), |
107 | | - 'client_key_file': os.path.join(default_certs_path, 'client-key.pem'), |
108 | | - 'client_key_password': 'clientPassword' |
| 99 | + "ca_file": os.path.join(default_certs_path, "localhost-ts.pem"), |
| 100 | + "client_cert_file": os.path.join(default_certs_path, "client-cert.pem"), |
| 101 | + "client_key_file": os.path.join(default_certs_path, "client-key.pem"), |
| 102 | + "client_key_password": "clientPassword", |
109 | 103 | } |
110 | 104 | # Identities and passwords to be used for service login if called for |
111 | | -default_nifi_username = 'nobel' |
112 | | -default_nifi_password = 'password' |
113 | | -default_registry_username = 'nobel' |
114 | | -default_registry_password = 'password' |
| 105 | +default_nifi_username = "nobel" |
| 106 | +default_nifi_password = "password" |
| 107 | +default_registry_username = "nobel" |
| 108 | +default_registry_password = "password" |
115 | 109 | # Identity to be used in the Registry Client Proxy setup |
116 | 110 | # If called for during policy setup, particularly bootstrap_policies |
117 | | -default_proxy_user = 'CN=localhost, OU=nifi' |
| 111 | +default_proxy_user = "CN=localhost, OU=nifi" |
118 | 112 |
|
119 | 113 | # Auth handling |
120 | 114 | # If set, NiPyAPI will always include the Basic Authorization header |
|
149 | 143 | registry_config.ssl_context.check_hostname = False |
150 | 144 | registry_config.ssl_context.verify_mode = ssl.CERT_NONE |
151 | 145 |
|
152 | | -if os.getenv('NIFI_CA_CERT') is not None: |
153 | | - nifi_config.ssl_ca_cert = os.getenv('NIFI_CA_CERT') |
154 | | - nifi_config.cert_file = os.getenv('NIFI_CLIENT_CERT') |
155 | | - nifi_config.key_file = os.getenv('NIFI_CLIENT_KEY') |
| 146 | +if os.getenv("NIFI_CA_CERT") is not None: |
| 147 | + nifi_config.ssl_ca_cert = os.getenv("NIFI_CA_CERT") |
| 148 | + nifi_config.cert_file = os.getenv("NIFI_CLIENT_CERT") |
| 149 | + nifi_config.key_file = os.getenv("NIFI_CLIENT_KEY") |
156 | 150 |
|
157 | 151 | # --- Encoding |
158 | 152 | # URL Encoding bypass characters will not be encoded during submission |
159 | | -default_safe_chars = '' |
| 153 | +default_safe_chars = "" |
160 | 154 |
|
161 | 155 | # Default String Encoding |
162 | | -default_string_encoding = 'utf8' |
| 156 | +default_string_encoding = "utf8" |
0 commit comments