-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow populating config with env vars (#38)
Allow populating config with env vars (#38)
- Loading branch information
1 parent
d6fb00c
commit b00efd8
Showing
29 changed files
with
141 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
All the settings can nnow be set using environment variables with prefix of OCEAN__{The name of the field} and __ between nested fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Using pyhumps to automatically camelize the aliases of the settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
All integration config is now decamelized and used as snake case inside the integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The broker field in the kafka settings has now the default of port production brokers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixed a crash when there are no resources in the port-app-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Renamed port_ocean.config.integration -> port_ocean.config.settings |
1 change: 1 addition & 0 deletions
1
integrations/gitlab/changelog/update-config-ocean-0-1-2.bump.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
changed the usage of the config according to ocean 0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,16 @@ | ||
# This is an example configuration file for the integration service. | ||
# Please copy this file to conf/config.yaml and edit it to your needs. | ||
|
||
# The integrations list to load into the integration port_ocean. | ||
# You can add as many integrations as you want, and you can use the same type of integration multiple times. | ||
initializePortResources: true | ||
port: | ||
clientId: {{ from env PORT_CLIENT_ID }} # Can be loaded via environment variable: PORT_CLIENT_ID, if both are set, the environment variable will be used. | ||
clientSecret: {{ from env PORT_CLIENT_SECRET }} # Can be loaded via environment variable: PORT_CLIENT_SECRET, if both are set, the environment variable will be used. | ||
baseUrl: http://localhost:3000 # Can be loaded via environment variable: PORT_BASE_URL, if both are set, the environment variable will be used. | ||
# The trigger channel to use for the integration service. | ||
# The event listener to use for the integration service. | ||
eventListener: | ||
type: KAFKA | ||
brokers: "localhost:9092" | ||
kafkaSecurityEnabled: false | ||
type: POLLING | ||
integration: | ||
# The name of the integration. | ||
identifier: "my_integration_2asdfasdfasdfasdfaasdsdfasdfasfd" | ||
identifier: "my_gitlab_integration" | ||
# The type of the integration. | ||
type: "gitlab" | ||
# The configuration of the integration. | ||
# resyncOnStartup: true | ||
config: | ||
tokenMapping: {{ from env GITLAB_TOKEN_MAPPING }} | ||
appHost: https://c0d5-81-199-132-66.ngrok-free.app | ||
tokenMapping: {{ from env TOKEN_MAPPING }} | ||
appHost: {{ from env APP_HOST }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import Any, Literal | ||
|
||
from pydantic import BaseSettings, BaseModel, Extra, AnyHttpUrl, parse_obj_as | ||
|
||
from port_ocean.config.base import BaseOceanSettings | ||
from port_ocean.core.event_listener import EventListenerSettingsType | ||
|
||
LogLevelType = Literal["ERROR", "WARNING", "INFO", "DEBUG", "CRITICAL"] | ||
|
||
|
||
class ApplicationSettings(BaseSettings): | ||
log_level: LogLevelType = "DEBUG" | ||
port: int = 8000 | ||
|
||
class Config: | ||
env_prefix = "APPLICATION__" | ||
env_file = ".env" | ||
env_file_encoding = "utf-8" | ||
|
||
@classmethod | ||
def customise_sources(cls, init_settings, env_settings, *_, **__): # type: ignore | ||
return env_settings, init_settings | ||
|
||
|
||
class PortSettings(BaseModel, extra=Extra.allow): | ||
client_id: str | ||
client_secret: str | ||
base_url: AnyHttpUrl = parse_obj_as(AnyHttpUrl, "https://api.getport.io") | ||
|
||
|
||
class IntegrationSettings(BaseModel, extra=Extra.allow): | ||
identifier: str | ||
type: str | ||
config: dict[str, Any] | ||
|
||
|
||
class IntegrationConfiguration(BaseOceanSettings, extra=Extra.allow): | ||
port: PortSettings | ||
event_listener: EventListenerSettingsType | ||
batch_work_size: int = 20 | ||
initialize_port_resources: bool = False | ||
integration: IntegrationSettings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.