> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Applicaties configureren

Welkom bij onze configuratiegids. Deze gids leert u hoe u configuraties voor uw AppSignal-integratie kunt toevoegen en wijzigen.

<Tip>
  Lees meer informatie over de configuratie van de AppSignal-integratie in uw
  app in onze [configuratiesectie][config topic].
</Tip>

## Kies een configuratieoptie

Deze gids leidt u door de stappen die nodig zijn om uw applicatie zo te configureren dat deze het beste bij uw behoeften past. Er zijn natuurlijk meerdere configuratieopties voor uw applicatie, maar omdat de implementatiemethode voor alle opties identiek is, richten we ons in deze gids op de volgende configuraties:

We gebruiken de `log_level` optie als voorbeeld voor [Ruby](/ruby/configuration/options#option-log_level), [Elixir](/elixir/configuration/options#option-log_level), [Node.js](/nodejs/3.x/configuration/options#option-loglevel) en [Python](/python/configuration/options#option-log_level) applicaties.

We gebruiken de `namespace` optie als voorbeeld voor [front-end JavaScript-applicaties](/front-end/configuration).

## Configuratiemethoden

Er zijn meerdere manieren om uw AppSignal-integratie te configureren, en integraties kunnen variëren afhankelijk van de taal van uw applicatie, maar ze hebben allemaal de volgende configuratiemethoden:

* [Bestandsgebaseerde configuratie:](#file-based-configuration)
  <br />Een configuratiebestand waaruit de AppSignal-integratie de
  AppSignal-configuratie leest.
* [Configuratie via systeemomgevingsvariabelen:][env]
  <br />
  Omgevingsvariabelen worden ingesteld op het hostsysteem (server) op het bovenliggende
  proces dat uw applicatie start.
  <br /> **Opmerking**: Deze methode is niet beschikbaar voor front-end JavaScript.

## Bestandsgebaseerde configuratie

Bestandsgebaseerde configuratie is de eenvoudigste manier om uw integratie te configureren.

Sommige integraties maken een configuratiebestand aan tijdens de installatie van AppSignal in de app. In deze configuratiebestanden kunt u op unieke wijze één of meerdere applicatieomgevingen configureren.

<Tip>
  Zorg ervoor dat u de waarde "Config file key" uit de configuratieopties-tabel gebruikt
  als configuratiesleutel. Deze sleutel is ofwel een snake\_cased (Ruby, Elixir, Python) of
  camelCased string (Node, Front-End JavaScript).
</Tip>

Configuratieopties voor:

* [Ruby](/ruby/configuration/options)
* [Elixir](/elixir/configuration/options)
* [Node.js](/nodejs/3.x/configuration/options)
* [Python](/python/configuration/options)
* [Front-end JavaScript](/front-end/configuration/)
* [Go](/go/configuration/options)

<Warning>
  Zorg ervoor dat u geen gevoelige configuratiewaarden, zoals de Push API-sleutel,
  incheckt in een source-control management systeem zoals Git, tenzij ze
  versleuteld zijn.
</Warning>

### Ruby

Bij gebruik van de Ruby integratie-gem wordt bij installatie het bestand `config/appsignal.yml` aangemaakt in de hoofdmap van uw applicatie, met basisconfiguratie-instellingen. Als uw applicatie gegevens rapporteert aan AppSignal zonder een `appsignal.yml` bestand, gebruikt uw applicatie hoogstwaarschijnlijk [systeemomgevingsvariabelen][env].

<Tip>
  Het bestand `config/appsignal.yml` is een YAML-bestand (Yet Another Markup Language).
  en wordt geïnterpreteerd als een ERB (Embedded Ruby) template. Zie de [Ruby
  Configuration][ruby config] documentatie voor meer details over hoe de YAML-
  configuratie werkt.
</Tip>

In het onderstaande voorbeeldconfiguratiebestand zijn twee omgevingen gedefinieerd, `development` en `production` - elk heeft omgevingsspecifieke configuratieopties die eronder zijn genest. Alles wat gedefinieerd en genest is binnen `default` is van toepassing op alle omgevingen, zolang default is opgenomen in de omgevingsmapping.

We willen het log\_level uitsluitend instellen op debug in onze `development`-omgeving; om dit te doen hebben we `log_level: "debug"` toegevoegd in de development-omgevingsconfiguratie (regel 10).

<CodeGroup>
  ```yaml YAML theme={null}
  # Example: config/appsignal.yml
  default: &defaults # Shared configuration options for all environments
    active: true
    name: "My awesome app"
    push_api_key: "<YOUR PUSH API KEY>"

  development: # Development environment
    <<: *defaults
    log_level: "debug" # This enables debug mode for only the development environment

  production: # Production environment
    <<: *defaults
  ```
</CodeGroup>

Onthoud dat alles wat genest is binnen `default` wordt toegepast op alle omgevingen, dus om het log\_level in te stellen op debug in alle omgevingen kunnen we in plaats daarvan de configuratie onder default nesten, zoals gedaan op regel 6 van het onderstaande voorbeeld:

<CodeGroup>
  ```yaml YAML theme={null}
  # Example: config/appsignal.yml
  default: &defaults
    active: true
    name: "My awesome app"
    push_api_key: "<YOUR PUSH API KEY>"
    log_level: "debug" # This enables debug mode for all environments
    # Other AppSignal config...

  development: # Development environment
    <<: *defaults
    # Other AppSignal config...

  production: # Production environment
    <<: *defaults
    # Other AppSignal config...
  ```
</CodeGroup>

Geweldig, nu heeft u geleerd hoe u AppSignal in uw Ruby-applicatie kunt configureren!

#### Meer lezen:

* [Configuratie-onderwerp Ruby-integratie][ruby config]
* [Details over de configuratie-laadvolgorde van de Ruby-integratie](/ruby/configuration/load-order)

### Elixir

Bij installatie creëert de Elixir-integratie een `config/appsignal.exs` (standaardlocatie) bestand met basisconfiguraties. Als dit bestand niet aanwezig is, maar uw applicatie wel gegevens rapporteert aan AppSignal, controleer dan een van de andere `.exs` bestanden in de map `config/` van uw Elixir-app. Als er in geen van de bestanden AppSignal-configuratie aanwezig is, gebruikt uw applicatie waarschijnlijk [systeemomgevingsvariabelen][env] als configuratiemethode.

Om een configuratieoptie toe te voegen en deze toe te passen op alle omgevingen van uw applicatie, voegt u de configuratieoptie toe aan het bestand `config/appsignal.exs`, zoals op regel 7 van het onderstaande voorbeeld:

<CodeGroup>
  ```elixir Elixir theme={null}
  # Example: config/config.exs
  config :appsignal, :config,
    active: true,
    name: "My awesome app",
    push_api_key: "<YOUR PUSH API KEY>",
    env: Mix.env,
    log_level: "debug" # This sets the log_level to debug for all environments
  ```
</CodeGroup>

Om de configuratieoptie alleen op één enkele omgeving toe te passen, voegt u de AppSignal-configuratie toe aan het configuratiebestand van die omgeving, dat zich in de map `config/` bevindt.

In het onderstaande voorbeeld is de log\_level optie toegevoegd op regel 3 van de development (of "dev") omgeving:

<CodeGroup>
  ```elixir Elixir theme={null}
  # Example: config/dev.exs
  config :appsignal, :config,
    log_level: "debug" # This only sets the log_level to debug for the "dev" environment
  ```
</CodeGroup>

Geweldig, nu heeft u geleerd hoe u AppSignal in uw Elixir-applicatie kunt configureren!

#### Meer lezen

* [Configuratie-onderwerp Elixir-integratie](/elixir/configuration/)
* [Details over de configuratie-laadvolgorde van de Elixir-integratie](/elixir/configuration/load-order)

### Node.js

Na installatie moet u een AppSignal-configuratiebestand aanmaken om uw applicatie te configureren. Als er geen bestand met AppSignal-configuratie aanwezig is, gebruikt deze hoogstwaarschijnlijk [systeemomgevingsvariabelen][env] als configuratiemethode.

Om AppSignal voor Node.js apps te configureren, raden we aan om een `appsignal.js` bestand met de AppSignal-configuratie te maken in de hoofd- of `src`-map van uw applicatie. Vereist/importeer het vervolgens vanuit de code van de app voordat andere pakketten worden vereist of geïmporteerd.

In het onderstaande voorbeeld is er een `appsignal.js` bestand in de hoofdmap van de app. In dit bestand voegen we de `logLevel` configuratieoptie toe.

<CodeGroup>
  ```javascript Node.js theme={null}
  // appsignal.js
  const { Appsignal } = require("@appsignal/nodejs");

  const appsignal = new Appsignal({
    active: true,
    name: "<YOUR APPLICATION NAME>",
    pushApiKey: "<YOUR API KEY>",
    logLevel: "debug", // Sets logLevel to debug for the Node.js environment
  });

  module.exports = { appsignal };
  ```
</CodeGroup>

De configuratie in het bovenstaande voorbeeld is van toepassing op de omgeving waarin Node.js draait (`NODE_ENV`, standaard "development").

In Node.js zijn er veel manieren om omgevingsspecifieke configuraties voor AppSignal te maken. Als u niet zeker weet hoe u dit binnen uw eigen applicatie moet doen, is een methode die we aanbevelen het gebruik van conditionals in uw `appsignal.js`, zoals in het onderstaande voorbeeld waar we debug specificeren voor de productie-omgeving.

1. Op regel 4 - we activeren de AppSignal-integratie alleen als de omgeving production is.
2. Op regel 8 - zoals in ons vorige codevoorbeeld stellen we de `logLevel` in op `debug`

<CodeGroup>
  ```javascript Node.js theme={null}
  // appsignal.js

  const appsignal = new Appsignal({
    active: process.env.NODE_ENV === "production"
    name: "<YOUR APPLICATION NAME>",
    pushApiKey: "<YOUR API KEY>",
    logLevel: "debug" // Sets logLevel to debug for the Node.js environment
  });
  ```
</CodeGroup>

Zodra uw configuratie is voltooid, moet u `appsignal.js` heel bovenaan het hoofdbestand van uw app vereisen. De naam van het hoofdbestand van uw applicatie kan variëren afhankelijk van hoe uw applicatie is gestructureerd. Het is het bestand dat u gebruikt om uw Node-applicatie te starten en wordt meestal `index.js` of `app.js` genoemd. Zorg ervoor dat AppSignal heel bovenaan het bestand wordt vereist, zoals in het onderstaande voorbeeld:

<CodeGroup>
  ```javascript Node.js theme={null}
  // index.js
  // Place this at the top
  const { appsignal } = require("./appsignal"); // Update to the location used in the previous step

  // Place your app code below this
  ```
</CodeGroup>

Geweldig, nu heeft u geleerd hoe u AppSignal in uw Node.js-applicatie kunt configureren!

#### Meer lezen

* [Configuratie Node.js-integratie][nodejs config]
* [Configuratie-laadvolgorde Node.js-integratie](/nodejs/3.x/configuration/load-order)

### Python

Bij gebruik van de Python-integratie-installer wordt het bestand `__appsignal__.py` aangemaakt in de hoofdmap van uw applicatie, met basisconfiguratie-instellingen. Uw applicatie kan ook worden geconfigureerd met behulp van [systeemomgevingsvariabelen][env].

Om een configuratieoptie toe te voegen en deze toe te passen op uw development-applicatieomgeving, voegt u de configuratieoptie toe aan het bestand `__appsignal__.py`, zoals in het onderstaande voorbeeld.

<CodeGroup>
  ```python Python theme={null}
  # __appsignal__.py
  from appsignal import Appsignal

  appsignal = Appsignal(
      active=True,
      name="My awesome app",
      push_api_key="<YOUR PUSH API KEY>",
      environment="development",
      log_level="debug",
  )
  ```
</CodeGroup>

Om AppSignal voor Python te configureren voor een andere omgeving, of om de configuratie op alle omgevingen toe te passen, configureert u de `environment` configuratieoptie op dezelfde manier waarop uw app zijn omgeving bepaalt (development/staging/production). Dit kan via een systeemomgevingsvariabele of een andere applicatiespecifieke methode. In het onderstaande voorbeeld gebruiken we een systeemomgevingsvariabele `MY_APP_ENV` om zowel de app-omgeving in te stellen als alleen te activeren voor de productie-omgeving.

<CodeGroup>
  ```python Python theme={null}
  # __appsignal__.py
  import os
  from appsignal import Appsignal

  app_env = os.environ.get("MY_APP_ENV")

  appsignal = Appsignal(
      active=app_env == "production",
      name="My awesome app",
      push_api_key="<YOUR PUSH API KEY>",
      environment=app_env,
  )
  ```
</CodeGroup>

Als u wilt dat sommige configuratieopties alleen op bepaalde omgevingen van toepassing zijn, maakt u conditionals die aan uw behoeften voldoen.

<CodeGroup>
  ```python Python theme={null}
  # __appsignal__.py
  import os
  from appsignal import Appsignal

  app_env = os.environ.get("MY_APP_ENV")

  options = {
      "active": app_env == "development",
      "name": "python/django4-celery",
      "environment": app_env,
  }
  if app_env == "development":
      options["log_level"] = "debug"

  appsignal = Appsignal(**options)
  ```
</CodeGroup>

Geweldig, nu heeft u geleerd hoe u AppSignal in uw Python-applicatie kunt configureren!

#### Meer lezen:

* [Configuratie-onderwerp Python-integratie][python config]
* [Details over de configuratie-laadvolgorde van de Python-integratie](/python/configuration/load-order)

### Front-end JavaScript

Om AppSignal voor front-end JavaScript te configureren, raden we aan om een `appsignal.js` bestand met de AppSignal-configuratie te maken in de hoofd- of `src`-map van uw project. Vereist of importeer het vervolgens vanuit de code van de app voordat andere pakketten worden vereist of geïmporteerd.

In het onderstaande voorbeeld is er een `appsignal.js` bestand in de hoofdmap van de applicatiemap. Op regel 8 hebben we de `namespace` configuratieoptie toegevoegd.

<CodeGroup>
  ```javascript JavaScript theme={null}
  // appsignal.js
  import Appsignal from "@appsignal/javascript"; // For ES Module
  const Appsignal = require("@appsignal/javascript").default; // For CommonJS module

  const appsignal = new Appsignal({
    key: "<YOUR FRONTEND API KEY>",
    namespace: "frontend", // Configure the AppSignal namespace for front-end errors in this app
  });

  module.exports = { appsignal };
  ```
</CodeGroup>

Zodra u klaar bent met de configuratie van uw applicatie, moet u `appsignal.js` heel bovenaan het hoofdbestand van uw applicatie vereisen, zoals in het onderstaande voorbeeld:

<CodeGroup>
  ```javascript JavaScript theme={null}
  // index.js
  // Place this at the top
  const { appsignal } = require("./appsignal"); // Update to the location used in the previous step

  // Place your app code below this
  ```
</CodeGroup>

En dat is het - u bent klaar om te gaan! Volg deze eenvoudige stappen voor alle toekomstige aanpassingen van configuratieopties.

#### Meer lezen

* [Configuratie Front-end JavaScript-integratie](/front-end/configuration/)

## Configuratie via systeemomgevingsvariabelen

<Warning>
  Deze configuratiemethode is niet beschikbaar voor front-end JavaScript.
</Warning>

Systeemomgevingsvariabelen, of kortweg "omgevingsvariabelen", zijn variabelen die toegankelijk zijn voor processen en worden geërfd van het bovenliggende proces dat ze start. In plaats van een [configuratiebestand][file] te gebruiken voor configuratie, is het mogelijk om AppSignal alleen te configureren met behulp van omgevingsvariabelen. Het is ook mogelijk om configuratiesleutels die gevoelige gegevens bevatten, zoals de Push API-sleutel, in een omgevingsvariabele op te slaan en [configuratiebestanden][file] te gebruiken voor de rest van de configuratie.

Deze configuratiemethode is compatibel met Ruby-, Elixir- en Node.js-applicaties.

Voordat we verdergaan met het volgende voorbeeld van het instellen van omgevingsvariabelen via een shell, leggen we uit hoe omgevingsvariabelen werken met betrekking tot shells en processen.

Omgevingsvariabelen kunnen toebehoren aan een proces zoals een shell of uw applicatie. Het commando `export FOO=BAR` zou bijvoorbeeld de `FOO` omgevingsvariabele van uw shell instellen op `BAR`. Omgevingsvariabelen worden geërfd tussen processen, dus wanneer die shell een nieuw proces start, heeft dat proces ook alle omgevingsvariabelen van de shell.

Wanneer u een proces in de shell start (d.w\.z. npm start) kunt u ook meer omgevingsvariabelen alleen voor dat proces opgeven door de variabelen als volgt toe te kennen: `FOO=BAR npm start`

Voor het gemak wilt u misschien uw shell configureren om bepaalde omgevingsvariabelen in te stellen wanneer deze start, zodat alle vanuit die shell gestarte processen die omgevingsvariabelen erven. Als u de `bash` shell gebruikt, worden de commando's in het `.bash_profile` bestand in uw home-map uitgevoerd wanneer de shell wordt gestart. Bij gebruik van `zsh`, de standaardshell in macOS, wordt in plaats daarvan het `.zshenv` bestand gebruikt om omgevingsvariabelen te configureren.

In het onderstaande voorbeeldbestand exporteren we de omgevingsvariabelen die de Push API-sleutel en het loglevel van AppSignal configureren, zodat wanneer een nieuwe shell wordt gestart, de juiste omgevingsvariabelen toegankelijk zijn voor uw applicatie, waardoor deze kan communiceren met AppSignal.

Configuratieopties die zijn ingesteld via omgevingsvariabelen zijn van toepassing op alle applicatieomgevingen, maar sommige configuratieopties zijn taalspecifiek. Bijvoorbeeld, de configuratieoptie `instrument_sequel` bestaat alleen in de Ruby-integratie, omdat Sequel een Ruby gem is, en daarom heeft het instellen van de `APPSIGNAL_INSTRUMENT_SEQUEL` omgevingsvariabele geen effect voor andere integraties.

<CodeGroup>
  ```sh Shell theme={null}
  # Bash shell example
  export APPSIGNAL_PUSH_API_KEY=<YOUR PUSH API KEY>
  export APPSIGNAL_LOG_LEVEL=debug # Sets log_level to debug for all environments.
  ```
</CodeGroup>

Er zijn verschillende mogelijke locaties voor bestanden met de configuratie van omgevingsvariabelen. Kies de beste optie die bij uw applicatie past, en zorg ervoor dat u uw terminal-shell opnieuw laadt na het maken van wijzigingen om ervoor te zorgen dat deze toegang heeft tot uw bijgewerkte variabelen.

* `~/.profile` of `~/.bash_profile` - Gebruikersspecifieke instellingen. Gebruik deze locatie om omgevingsvariabelen per gebruiker te configureren.
* `/etc/profile` - Systeembrede instellingen. Als meerdere gebruikers of apps dezelfde hostmachine gebruiken, gebruik deze locatie dan niet.

Platform-as-a-Service (PaaS) hostingproviders zoals Heroku bieden geen systeem voor het rechtstreeks configureren van omgevingsvariabelen in de shell. U kunt in plaats daarvan hun webinterface of CLI gebruiken om deze omgevingsvariabelen te configureren.

<Note>
  Zorg er bij gebruik van configuratie op basis van systeemomgevingsvariabelen voor
  dat u de waarde "System environment key" uit de configuratieopties-tabel als
  configuratiesleutel gebruikt. Deze sleutel is altijd in hoofdletters\* snake case,
  zoals dit:
  `EXAMPLE_OF_A_CONFIG_KEY`

  <br />

  ***Leuk weetje:** dit staat ook bekend als SCREAMING\_SNAKE\_CASE 🐍*
</Note>

## De configuratie voltooien

Nadat u uw AppSignal-configuratie heeft gewijzigd, moet uw applicatie opnieuw worden opgestart of gedeployed zodat de configuratiewijzigingen door AppSignal worden gedetecteerd.

Worden configuratiewijzigingen niet gedetecteerd? [Neem contact met ons op][contact] en wij helpen u verder! Om ons te helpen uw probleem sneller te debuggen, raden we aan om ons een [diagnoserapport](/support/debugging#diagnose) vanaf de host van uw applicatie te sturen.

## Verder lezen

Lees meer over configuratie in onze [Application Configuration][config topic] documentatie.

[config topic]: /application/configuration.html

[contact]: mailto:support@appsignal.com

[env]: #system-environment-variable-configuration

[file]: #file-based-configuration

[nodejs config]: /nodejs/3.x/configuration/

[ruby config]: /ruby/configuration/

[python config]: /python/configuration/
