Go to file
Urko 762ba66de8 feat: add README 2023-02-15 19:41:00 +01:00
cmd todo: tests 2023-02-15 19:30:20 +01:00
internal feat: use viper and cobra to parameterize creation values with viper yaml 2023-02-15 19:30:05 +01:00
pkg feat: use viper and cobra to parameterize creation values with viper yaml 2023-02-15 19:30:05 +01:00
.env.example feat: add .env.example 2023-02-15 19:34:48 +01:00
.gitignore feat: update .gitignore 2023-02-15 18:14:10 +01:00
README.md feat: add README 2023-02-15 19:41:00 +01:00
go.mod feat: use viper and cobra to parameterize creation values with viper yaml 2023-02-15 19:30:05 +01:00
go.sum feat: use viper and cobra to parameterize creation values with viper yaml 2023-02-15 19:30:05 +01:00
main.go feat: use viper and cobra to parameterize creation values with viper yaml 2023-02-15 19:30:05 +01:00
viper.example.yaml feat: update viper example 2023-02-15 19:27:44 +01:00

README.md

go-gen-cert

Configuration

If you are on dev environment, like I've been doing, you must create .env file similar as .env.example in this repo:

VIPER_CONFIG=your-viper-file-name-without-extension
VIPER_CONFIG_TYPE=yaml
ENV=dev

Then add viper configuration file, yaml for example, in your root directory:

export_dir: "/home"
ca:
    serial_number: 12152 # serial number
    subject:
        organization: "yourdomain.com"
        common_name: "*.yourdomain.com"
    key_usage: 1
    ext_key_usage: 
        - 1
        - 2
        duration: 518400 #1 year
client:
    serial_number: 12151232 # serial number
    subject:
        organization: "yourdomain.com"
        country: "RM"
        province: "REML"
        locality: ""
        street_address: ""
        postal_code: ""
    subject_key_id:
        - 1
        - 2
        - 3
        - 4
        - 6
    key_usage: 1
    ext_key_usage: 
        - 1
        - 2
    duration: 518400

Execution

Then you can just run

go run main.go