go-admingo-admin
  • Guide
  • Development
    • Advanced
    • Commands
  • Advanced
  • Help
  • GitHub
  • Changelog
⌘ K
Standard Practice
Standard Module Development
Backend Basics
Backend Directory Structure
Backend Config File
Starting the Backend
Frontend Basics
Frontend Directory Structure
Frontend Config File
Starting the Frontend
Development Patterns
Actions Pattern
Hand-Written Pattern
First API Endpoint
Layered Development
API Layer
Service Layer
DTO Definitions
Model Definitions
Router Registration
Multi-Environment Config
Database Table Conventions
Data Permissions
Response Format
Code Generation
Pre-Generation Setup
Generating Business Code
One-Click Menu Generation
Binding APIs to the Menu
Configuring Role Permissions
Verifying the Feature
Generating Code with an LLM
Advanced Capabilities
Runtime Core API
Authentication & Authorization
Logging
Request Tracing
Cache
Queue
File Upload
Rate Limiting
Scheduled Jobs
Air Hot Reload
Swagger Docs
Code Generation Tool
Last updated:
Open-source MIT Licensed | Copyright © 2020-present
Powered by go-admin-team

TABLE OF CONTENTS

‌
‌
‌
‌

Creating Config Files per Environment

go-admin's config file lives at settings.yml under config by default.

You can create a separate file per environment:

sh
# a config file for development
settings.dev.yml
# a config file for production
settings.prod.yml
# a config file for testing
settings.test.yml

Adding Custom Config Fields

Add an extend block under settings, and put whatever fields you need under it.

yml
settings:
extend: # usage notes for the extension block
demo:
name: data

Then, open config/extend.go and add:

go
type Extend struct {
Demo Demo // configure the struct to match your config block
}
type Demo struct {
name string
}

That's it.

Reading a Custom Config Field

Import it wherever you need it:

go
import (
extConfig "go-admin/config"
)

Then use it directly:

go
fmt.Println("extConfig.ExtConfig.Demo.Name", extConfig.ExtConfig.Demo.Name)

WARNING

Where to get help:

If anything in this guide is unclear, please open an issue.