You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
readme += "This template also defines default tasks in `vix.json`.\n\n";
1025
+
1016
1026
readme += "Run them with:\n\n";
1017
1027
readme += "```bash\n";
1018
1028
readme += "vix task <name>\n";
@@ -1039,34 +1049,46 @@ int main()
1039
1049
readme += "You can edit `vix.json` to customize commands, variables, environments, and task pipelines.\n\n";
1040
1050
1041
1051
readme += "## Configuration\n\n";
1042
-
readme += "Vix applications do not auto-load project configuration by default.\n";
1043
-
readme += "If you want to use a project-level configuration, for example to configure the server port,\n";
1044
-
readme += "you must explicitly initialize and read it in your application.\n\n";
1052
+
readme += "Vix applications use `.env` files for project configuration.\n";
1053
+
readme += "This lets you configure ports, database settings, logging, WebSocket options, and other runtime values without changing your C++ code.\n\n";
1045
1054
1046
-
readme += "### Project config file\n\n";
1047
-
readme += "Create a configuration file at:\n\n";
1055
+
readme += "### Project env file\n\n";
1056
+
readme += "Create a file at the project root:\n\n";
1048
1057
readme += "```\n";
1049
-
readme += "config/config.json\n";
1058
+
readme += ".env\n";
1050
1059
readme += "```\n\n";
1051
1060
1052
1061
readme += "Example:\n\n";
1053
-
readme += "```json\n";
1054
-
readme += "{\n";
1055
-
readme += "\"server\": {\n";
1056
-
readme += "\"port\": 8081\n";
1057
-
readme += " }\n";
1058
-
readme += "}\n";
1062
+
readme += "```env\n";
1063
+
readme += "SERVER_PORT=8081\n";
1064
+
readme += "DATABASE_ENGINE=mysql\n";
1065
+
readme += "DATABASE_DEFAULT_HOST=127.0.0.1\n";
1066
+
readme += "DATABASE_DEFAULT_PORT=3306\n";
1067
+
readme += "DATABASE_DEFAULT_USER=root\n";
1068
+
readme += "DATABASE_DEFAULT_PASSWORD=\n";
1069
+
readme += "DATABASE_DEFAULT_NAME=appdb\n";
1070
+
readme += "LOGGING_ASYNC=true\n";
1071
+
readme += "WAF_MODE=basic\n";
1059
1072
readme += "```\n\n";
1060
1073
1061
-
readme += "### Using the config in code\n\n";
1074
+
readme += "### Layered env files\n\n";
1075
+
readme += "Vix supports layered env files.\n";
1076
+
readme += "Depending on your environment, you can use files such as:\n\n";
1077
+
readme += "- `.env`\n";
1078
+
readme += "- `.env.local`\n";
1079
+
readme += "- `.env.production`\n";
1080
+
readme += "- `.env.production.local`\n\n";
1081
+
1082
+
readme += "This makes it easy to separate local development and production configuration.\n\n";
1083
+
1084
+
readme += "### Using config in code\n\n";
1062
1085
readme += "To use the project configuration, initialize and read it explicitly:\n\n";
0 commit comments