# Environment Variable Settings

Beside its [system settings](https://docs.ngsurvey.com/installation-setup/system-settings) you can also configure ngSurvey's core using following environment variable. These variables can also bet set either in the web.config file if you are using IIS or within the ngsurvey.settings.json file.

{% hint style="info" %}
In a default Azure Linux app service or a custom Linux container any `:` in the variable name should be replaced by `__` (double underscore).
{% endhint %}

## 🔅 Environment variables

* **`NGSurvey:Secret`**&#x65;ncryption key used to sign the JWT and security items tokens. Must be at least 64 chars long.&#x20;
* **`NGSurvey:AutoDBSetup`** by default ngSurvey will automatically configure or upgrade your target database. If you want to disable the auto install / upgrade process you can set this variable to false. In such a case you will need to install manually the database using the [dacpac](https://docs.ngsurvey.com/installation-setup/installation/database-backend/microsoft-sql-server) file for Microsoft SQL Server. MariaDB or MySQL will only be installed by ngSurvey directly, we don't offer any scripts or code to install and setup the database  manually by yourself.
* **`NGSurvey:MailingBatchPoolingDelay`**&#x69;s the delay in minutes after which the mailing related batchs like campaign email sending will trigger. Default is 1 minute.
* **`NGSurvey:MaxMailingThread`** let you define how many worker threads will be used during the email sending process. Be careful when setting the number of threads as each thread will open a connection to your mail server. The default is 2.
* **`NGSurvey:EnableTenants`** if you own a Tenant License you have to enable the tenants on your installation by setting this variable to true.&#x20;
* **`NGSurvey:DisableEmailBlacklisting`** disables the ability to blacklist emails for campaigns if set to true.
* **`NGSurvey:DisableMobilePhoneNumberBlacklisting`** disables the ability to blacklist mobile phones for campaigns if set to true.
* **`NGSurvey:EnableSwagger`** if set to false will disable the access to the API documentation at <https://yourngsurveysite/api.&#x20>;
* **`NGSurvey:DistributedCache`**&#x65;nables distributed cache if set to true. Distributed cache must be enabled if you are using ngSurvey on [cluster](https://docs.ngsurvey.com/installation-setup/installation/cluster-scale-out-configuration) like configuration
* **`NGSurvey:CacheTimeout`** ngSurvey uses internal caches to improve performances. By default these caches don't expire. You can set a timeout in minutes if you would like to set an expiration time for these caches to be flushed at regular interval.&#x20;
* **`NGSurvey:PanelSyncronizerThreadsNumber`** defines the number of threads that will be used to synchronize the panels against their data sources. The default is 6. Be careful as each thread can open a new connection to the data source to which your panel is connected.&#x20;
* **`NGSurvey:Languages`** an array of languages code that will be selectable for the administration section.  :&#x20;
* **`NGSurvey:ClusterNode`** defines if set to true if the instance is running on a cluster node. Instances having the cluster node set to true will not run any kind of background jobs. You should keep the background jobs either on a separate instances that is not serving any surveys or on only one instance.&#x20;
* **`NGSurvey:EncryptionKey`** this encryption key will be used for all encryption of data at the database level like connection strings, passwords, sensitive settings.  Must be min. 64 characters long. Make sure to keep a backup of the key as it without the key you may not be able to recover any of your ngSurvey data.
* **`NGSurvey:AccountLockoutThreshold`** number of times a login can try to authenticate before its being locked out.
* **`NGSurvey:AccountLockoutDuration`** number of minutes during which the login account is locked before allowing to authenticate again. &#x20;
* **`NGSurvey:EnableHSTS`**&#x65;nables HSTS if you are using SSL all cookies will be set as secure.&#x20;
* **`NGSurvey:WebSetupDisabled`** disable the web installation interface of ngSurvey to true.
* **`NGSurvey:CaptchaDisabled`** disable capcha features if set to true.
* **`NGSurvey:TwoFactorDisabled`** disables two factor on login authentication if set true. Can be used to bypass the two factor authentication if any issue arises.
* **`NGSurvey:ClearActivityLogsOlderThanDays`** number of days to keep the activity log data.
* **`NGSurvey:ClearActivityLogTresholdDays`** number of days before the activity log data gets permanently deleted.
* **`NGSurvey:EncryptActivityLog`** if set to true will encrypt the activity log data at the database level.
* **`NGSurvey:PersitentMailStorageLocation`** path to a folder that can be used to backup messages that are saved in the pickup exchange folder in case you are using the Exchange pickup folder to send out emails. &#x20;
* **`NGSurvey:MaxAllowedTextSize`** maximum allowed text size in bytes that can be stored in the system. Can be used to prevent overflow attacks on the system. Default is 10485760.
* **`NGSurvey:MailServerTest`** if set to true will not send directly emails through the configured mail server.
* **`NGSurvey:LoadTest`** if set to true will allow posting multiple times the same respondent answers.&#x20;
* **`NGSurvey:AdminDisabled`** if set to true will disable all admin related features from the API. If disabled only the API related to survey retrieval and respondent submissions will be available.&#x20;
* **`NGSurvey:CPSPolicy`**&#x69;f set to "Self" will enforce the content security policy (CSP) on the browser. Note that widget based answer items and any custom JavaScript related features will be disabled if set to Self.&#x20;
* **KeyVault:Name** name of the Azure key vault if you plan to store your environment variable in Azure's key vault.&#x20;
* **AzureAd:ClientId** client Id of the Azure's key vault.&#x20;
* **AzureAd:ClientSecret** client secret to access the Azure's ley vault.
* **`NGSurvey:RedisConnectionString`** connection string to the Redis caching server.
* **`NGSurvey:RedisInstanceName`** optional Redis instance name
* **`NGSurvey:ActivityLogAzureWorkspaceId`** Azure log analytics workspace id to log activities
* **`NGSurvey:ActivityLogAzureAuthenticationId`** Azure log analytics agent authentication id
* **`NGSurvey:ActivityLogAwsAccessKeyId`** AWS CloudWatch access key id to log activities
* **`NGSurvey:ActivityLogAwsSecretAccessKey`** AWS CloudWatch secret key
* **`NGSurvey:ActivityLogAwsRegion`** AWS CloudWatch region&#x20;
* **`NGSurvey:ActivityLogAwsLogGroup`** AWS CloudWatch log group
* **`NGSurvey:ActivityLogApplicationInsightsKey`** Azure application insights key to log activities&#x20;
* **`NGSurvey:ActivityLogUseEventLog`** if set to true will log activities to the Windows event log.
* **`NGSurvey:AccountJWTAccessTokenExpiration`** Account level developer JWT token expiration time in minutes. Default 90 days, max 6 months.&#x20;
* **`NGSurvey:FormJWTAccessTokenExpiration`** Survey/Form level developer JWT token expiration time in minutes. Default 2 days, max 7 days.
* **`NGSurvey:FormJWTAccessTokenExpiration`** Survey/Form level developer JWT token expiration time in minutes. Default 2 days, max 7 days.
* **`NGSurvey:PostgresAzureScope`** Azure scope that manages the Entra access tokens to use Postgres along with an Entra Managed Account.
