> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# getConfig

> Look up a configuration value passed to the skill's constructor.

Look up a configuration value by key, with an optional default. The `config`
object is whatever was passed to the skill's constructor (typed as
`SkillConfig`, a string-keyed record). Values are returned as-is; the caller
provides the type argument for casting.

## **Parameters**

<ParamField path="key" type="string" required={true} toc={true}>
  The configuration key to look up.
</ParamField>

<ParamField path="defaultValue" type="T | undefined" toc={true}>
  Value to return when the key is not present. The result is cast to `T`.
</ParamField>

## **Returns**

`T` -- the configured value cast to the generic type, or the default value.

## **Example**

```typescript {9,10}
import { SkillBase } from '@signalwire/sdk';

export class WeatherSkill extends SkillBase {
  static SKILL_NAME = 'weather';
  static SKILL_DESCRIPTION = 'Fetches current weather for a city.';

  async setup(): Promise<boolean> {
    const apiKey = this.getConfig<string>('api_key');
    const units = this.getConfig<'metric' | 'imperial'>('units', 'metric');
    if (!apiKey) return false;
    this.logger.info(`Weather skill configured in ${units} units`);
    return true;
  }
}
```