Configuration¶
Iniesta provides an extensive list of
configurations for its behavior. All
Iniesta settings are prefixed with
INIESTA
and are loaded into Insanic’s
settings on initialization.
Important Configurations¶
If you have read through the Getting Started documentation, there are some mandatory configurations for Iniesta to function properly.
INIESTA_INITIALIZATION_TYPE
¶
This is arguably the most important as it determines how Iniesta will be running. The value should be a tuple of strings with the values being:
SNS_PRODUCER
EVENT_POLLING
QUEUE_POLLING
CUSTOM
A combination of the above values can be set and Iniesta will run accordingly. More information is provided in their respective initialization type documentations.
INIESTA_SNS_PRODUCER_GLOBAL_TOPIC_ARN
¶
If you have initialized Iniesta with either SNS_PRODUCER
and/or
EVENT_POLLING
, this value becomes required.
When “publishing” messages, Iniesta needs the topic arn to publish its messages to.
When polling for events, Iniesta needs it to verify that all the necessary AWS resources and permissions have been created.
INIESTA_SQS_CONSUMER_FILTERS
¶
This is the list of events that Iniesta should be expecting. It should be a list of strings that represent the events.
Some examples could be:
"UserCreated.user"
: To only receive the literal event."PostCreated.*"
: To receive allPostCreated
events regardless of who produced it.
Because of AWS filter policy restrictions, only prefixes can be filtered for. Currently Iniesta only provides values for exact matching or prefix filtering.
For more information view the AWS Filter Policy Documentation for more information.
INIESTA_SNS_EVENT_KEY
¶
This is the string value of the key of the event. This is essentially the key that is set in the filter policies, with the event as the value.
INIESTA_SQS_QUEUE_NAME
¶
The default SQS queue that Iniesta should be polling. If not
set it fallbacks to INIESTA_SQS_QUEUE_NAME_TEMPLATE
,
where the templates is iniesta-{env}-{service_name}
(e.g. iniesta-development-user
).
AWS Configurations¶
There are 3 configs that will need to be set for Iniesta to communicate with AWS APIs.
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
If for example you have separate access keys and secrets from
the default you can prefix INIESTA_
and Iniesta will
take those over the ones without the prefix.
Value Priority¶
AWS_*
from the environment.INIESTA_AWS_*
from Insanic’s settings.AWS_*
from Insanic’s settings.
The loaded variables can be access from
iniesta.sessions.BotoSession
. These are the values
that Iniesta uses through the package.
Configuration Reference¶
-
INIESTA_CACHES
: Dict[str, dict] = {'iniesta1': {'DATABASE': 1, 'HOST': 'localhost', 'PORT': 6379}, 'iniesta2': {'DATABASE': 2, 'HOST': 'localhost', 'PORT': 6379}, 'iniesta3': {'DATABASE': 3, 'HOST': 'localhost', 'PORT': 6379}}¶ The redlock caches
-
INIESTA_INITIALIZATION_TYPE
: tuple = ()¶ The initialization type Iniesta will be initialized with.
-
INIESTA_SNS_PRODUCER_GLOBAL_TOPIC_ARN
: str = None¶ The topic arn for the SNS that will receive messages.
-
INIESTA_SQS_RECEIVE_MESSAGE_MAX_NUMBER_OF_MESSAGES
: int = 10¶ The number of messages to receive while polling. Value between 0-10
-
INIESTA_SQS_RECEIVE_MESSAGE_WAIT_TIME_SECONDS
: int = 20¶ The time to wait between receiving SQS messages. A value between 0-20 (0 for short polling).
-
INIESTA_SQS_CONSUMER_FILTERS
: List[str] = []¶ The filters you would like for your application’s queue to filter for.
-
INIESTA_ASSERT_FILTER_POLICIES
: bool = True¶ If you would like to verify the filter policies on AWS match the filter policies declared in your application.
-
INIESTA_SNS_EVENT_KEY
: str = 'iniesta_pass'¶ The event key that will be filtered.
-
INIESTA_SQS_QUEUE_NAME
: Optional[str] = None¶ The default sqs queue name
-
INIESTA_SQS_QUEUE_NAME_TEMPLATE
: str = 'iniesta-{env}-{service_name}'¶ The SQS queue name template, if you have a normalized queue naming scheme.
-
INIESTA_LOCK_RETRY_COUNT
: int = 1¶ The retry count for attempting to acquire a lock.
-
INIESTA_LOCK_TIMEOUT
: int = 10¶ The lock timeout for the message. Will release after defined value.
-
INIESTA_AWS_ACCESS_KEY_ID
= None¶ Your AWS Access Key if it is different from other access keys.
-
INIESTA_AWS_SECRET_ACCESS_KEY
= None¶ Your AWS Secret Access Key if it is different from other access keys.
-
INIESTA_AWS_DEFAULT_REGION
: Optional[str] = None¶ Your AWS Default Region if it is iniesta specific