config

Standardize OrangeHRM hs_hr_config key/value settings handling across runtime and migrations.

1.1k|746|Updated Jan 5, 2017
One-click install
npx skills add https://github.com/orangehrm/orangehrm --skill config-orangehrm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: config
Source: https://github.com/orangehrm/orangehrm/tree/main/.agents/skills/config
Command: npx skills add https://github.com/orangehrm/orangehrm --skill config-orangehrm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

OrangeHRM uses a single key/value settings table (hs_hr_config) for all application-level tunable settings, but inconsistent handling of this table leads to bugs from hardcoded string keys, incorrect type coercion, mixing up runtime and migration access paths, and accidentally storing domain data in the config table instead of proper entities.

Core Features & Use Cases

  • Type-safe runtime config access: Provides guidance for using ConfigService and ConfigServiceTrait to read/write settings with proper type coercion, avoiding errors from string-stored booleans and numbers.
  • Migration-safe config seeding: Guides correct use of ConfigHelper for installer and upgrade migrations, with guards to prevent overwriting operator-customized settings during re-runs.
  • Config vs entity decision framework: Helps developers choose the correct storage location for new settings, avoiding performance issues from unindexed config value queries and improper storage of per-user or domain data. Use case: When adding a new password policy feature flag to OrangeHRM, use this skill to add the typed accessor methods, seed the default value safely in a migration, and access the setting from runtime services without hardcoding the config key string.

Quick Start

Use the config skill to add a new typed getter and setter for the 'auth.password_policy.min_special_chars' setting in ConfigService, and seed its default value of '2' in the next migration script.

Frequently Asked Questions about config

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new setting to OrangeHRM's hs_hr_config table without hardcoding string keys?

Use ConfigService and ConfigServiceTrait to add a typed accessor method for runtime access, then seed the default value in a migration script using ConfigHelper. This prevents string key hardcoding errors and ensures proper type coercion for the new setting.

How does OrangeHRM handle type coercion for boolean and numeric config values stored as strings?

OrangeHRM handles type coercion through ConfigService and ConfigServiceTrait, which provide type-safe accessor patterns for reading and writing config values. This prevents common runtime errors when converting string-stored booleans and numbers from the hs_hr_config table.

How do I prevent migration scripts from overwriting customized OrangeHRM config settings during upgrades?

To prevent overwriting customized OrangeHRM config settings during upgrade migrations, use ConfigHelper with migration seeding guards. These guards check if a setting already exists before inserting, preserving operator-customized values during re-runs of the migration scripts.

When should I store data in the OrangeHRM config table versus creating a proper entity?

You should store data in the OrangeHRM config table for application-level tunable settings, and use proper entities for per-user or domain data. Storing domain data in config rows causes performance issues from unindexed queries and violates the config vs entity decision framework.

What is the correct key naming convention for OrangeHRM feature flags and runtime settings?

The correct key naming convention for OrangeHRM feature flags uses a dotted namespace format, such as 'auth.password_policy.min_special_chars'. Following this convention ensures consistent access patterns and prevents key collision across different modules and services.

Why are my OrangeHRM migration seeding scripts failing to apply default config values correctly?

Migration seeding scripts fail when they lack proper guards or use incorrect access paths instead of ConfigHelper. Mixing runtime and migration code paths leads to incorrect type coercion and can accidentally overwrite existing operator-customized settings in the hs_hr_config table.