# Widget Configuration Setup

This widget now uses a configuration file to manage environment-specific URLs instead of hardcoded values.

## Setup Instructions

1. Copy the sample configuration file:
   ```bash
   cp config.sample.php config.php
   ```

2. Edit `config.php` to match your environment:
   - Set `current_environment` to `staging`, `production`, or `local`
   - Modify base URLs if needed
   - Update endpoints if required

## Files Modified

- `source/js/sma_widget.js` - Updated to use configuration variables
- `source/index.php` - Added configuration loading and JavaScript variables
- `config.php` - Main configuration file (not committed to SVN)
- `config.sample.php` - Sample configuration file (committed to SVN)
- `.svnignore` - Ensures config.php is not committed

## Configuration Structure

```php
return [
    'base_urls' => [
        'staging' => 'https://widget-staging.socialmarketanalytics.com',
        'production' => 'https://widget.socialmarketanalytics.com',
        'local' => 'http://widgets.sma.loc',
    ],
    'current_environment' => 'staging',
    'endpoints' => [
        'server_js' => '/security_level_trend/source/js/server.js?v=2.3',
        'help_detail_image' => '/sma_lime_intra_day/source/images/help_detail.png?1',
        'sync_config_js' => '/sync_widgets_config/sync_widget_config.js',
        'learn_more_html' => '/sma_lime_odometer/demo/learn_more.html',
    ]
];
```

## Benefits

- Environment-specific configuration without code changes
- Configuration files are not committed to version control
- Easy to maintain different environments (staging, production, local)
- Centralized URL management